Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

No visual MapPoint

This is a discussion on No visual MapPoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi. I'm searching a way to create an object with mappoint for a service. But no visible object. without components ...

  1. #1
    robinsongm is offline Junior Member White Belt
    Join Date
    Sep 2006
    Posts
    8

    No visual MapPoint

    Hi.

    I'm searching a way to create an object with mappoint for a service. But no visible object. without components like panels, forms, or whatever thing like those. I need it for delphi 7. In this moment i'm testing with a visual form, and with an OleContainer i can create mappoint on a Panel (The container), but it isn't i need.

    somebody know how?

    thanks!

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    This little Delphi class opens mappoint in background (invisible). It try to open version 2004 Europe first, if not it checks for 2002 version. You eventally have to change the registry search for version 2006 and of course for the US versions also if nececary.

    Code:
    unit uMP;
    
    interface
    
    uses
      Windows, SysUtils, Classes, MapPoint_TLB, Registry, Math;
    
    type
      TOnError = procedure(Sender: TObject; E: Exception) of object;
    
      TMapPoint = class
      private
        FMP: _Application;
        FOnError: TOnError;
      public
        constructor Create(ErrorProc: TOnError);
        destructor Destroy; override;
      end;
    
    implementation
    
    { TMapPoint }
    
    constructor TMapPoint.Create(ErrorProc: TOnError);
    var
       Reg: TRegistry;
       FileName: string;
    begin
       inherited Create;
       FOnError := ErrorProc;
       try
          FMP := CoApplication.Create;
          Reg := TRegistry.Create;
          try
             Reg.RootKey := HKEY_CLASSES_ROOT;
             if not Reg.OpenKey('.ptm\MapPoint.Map.EU.11\ShellNew', False) then
                if not Reg.OpenKey('.ptm\MapPoint.Map.EU.9\ShellNew', False) then
                   Exit;
             FileName := Reg.ReadString('FileName');
             FMP.OpenMap(FileName, False);
          finally
             Reg.Free;
          end;
       except
          on E: Exception do
             if Assigned(FOnError) then
                FOnError(Self, E);
       end;
    end;
    
    destructor TMapPoint.Destroy;
    begin
       FMP.ActiveMap.Saved := True;
       FMP.Quit;
       inherited;
    end;

  3. #3
    robinsongm is offline Junior Member White Belt
    Join Date
    Sep 2006
    Posts
    8

    Thumbs up Thanks!

    Great!.
    Very easy.

    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. mappoint, visual c++ vs visual basic
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 03-30-2004, 10:17 PM
  2. Visual Basic. NET and MapPoint
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-30-2003, 03:49 PM
  3. Visual C++.net and MapPoint
    By evschu in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-07-2003, 05:04 PM
  4. Visual basic or visual c++ in mappoint
    By misterb83 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-14-2003, 09:31 AM
  5. I am using Mappoint with Visual C++ via automation....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 07-08-2002, 02:07 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27