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 4 of 4

Error opening ptm file

This is a discussion on Error opening ptm file within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi everyone. I'm new to Mappoint and have just added MP routing to an application I am developing. I have ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Error opening ptm file

    Hi everyone. I'm new to Mappoint and have just added MP routing to an application I am developing. I have successfully created the ptm file but when I try to open it from my app, I get "The file does not exist in the specified location". I know the path is correct and that the file is there. I'm running the app from the VS.NET IDE. Here's the code that saves and opens the file:

    If sPtmFile = "" Then
    Randomize()
    iTemp = Int((1000000 * Rnd()) + 1)
    sPtmFile = Trim(Application.StartupPath) & "\TempMaps\TempMap" & CStr(iTemp) & ".ptm"
    End If

    If sOpenWith = "Mappoint" Then
    oApp.ActiveMap.SaveAs(Filename:=sPtmFile)
    oApp.ActiveMap.Saved = True
    oApp.Quit()
    SysProc.Start("Mappoint.exe", sPtmFile)
    End If

    The error occurs when the SysProc funtion attemps to start MP and open the file. I've checked the value of sPtmFile a hundred times and I know it's correct. I can also find the file in Windows Explorer and dblclick it to open it with MP, or open MP and do File->Open on it, so I know there's nothing wrong with the file. Any help you can give me I would appreciate.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Is it missing a backslash after TempMap?

    sPtmFile = Trim(Application.StartupPath) & "\TempMaps\TempMap" & CStr(iTemp) & ".ptm"


    sPtmFile = Trim(Application.StartupPath) & "\TempMaps\TempMap\" & CStr(iTemp) & ".ptm"

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Thanks for responding John, but actually "Tempmap" is part of the filename, then I add a random number and the ptm extension. An example is:

    c:\Program Files\MyApp\TempMaps\TempMap123456.ptm

    where the "c:\Program Files\MyApp" would be the Application.StartupPath.

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Why not open mappoint (if not already open) and use the open map method?

    Here are the samples from the helpfile.

    Code:
    'Assume the MappointControl on your form is named "MappointControl1"
    
      Private Sub Form_Load()
        'Assume the file exists in the default directory
        MappointControl1.OpenMap "Clients.ptm"
      End Sub
    Code:
    Sub OpenSampleMap()
    
      Dim objApp As New MapPoint.Application
    
      'Set up application
      objApp.Visible = True
      objApp.UserControl = True
    
      'Open a sample map
      objApp.OpenMap objApp.Path + "\Samples\Clients.ptm"
    
      End Sub

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Opening an application from hyperlink of Pushpin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 07-21-2009, 02:49 PM
  2. Opening a 2000 file
    By FDPoint in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-03-2004, 07:35 AM
  3. Error..cant find file
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-20-2004, 03:18 PM
  4. Error on importing shape file
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-26-2003, 11:26 AM
  5. Opening a new map takes about 10 sec ?!?!?!
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-25-2002, 01:43 PM

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