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

MapPoint to Gif Programatically

This is a discussion on MapPoint to Gif Programatically within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am creating a series of gif files based upon location information that I feed to Map Point. I use ...

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

    MapPoint to Gif Programatically

    I am creating a series of gif files based upon location information that I feed to Map Point. I use the 'Save As' method to push the map into an HtML. I grab the image and push it into an Image Object. Then I repeat the routine. And something is holding on to the image. The Map Point Application has been cleaned up as well as the ancillary objects I use (Map, Location, PushPin), etc. Is there something I am missing?
    It goes something like this:

    objMapApp = new mappoint.application
    objMap = Find(some criteria)
    objMap.SaveAs(htmlpath,saveashtml)
    objImage = Image.fromFile(imagepath & "image_map.gif")
    objMapApp.quite
    objMapApp = nothing

    This works fine until I repeat the process... then nothing can touch that image file (no system.io operations, no MapPoint.SaveAs)

    Any thoughts?

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Have you ruled out this FromFile Method part of the code?
    Code:
    objImage = Image.fromFile(imagepath & "image_map.gif")

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

    Yes, I have.

    Right now, I'm getting around it by generating a random file name for each new html I create. And everything is being created correctly.
    But I still can't clean up the files until I leave my application.

    Somewhere, something in MapPoint isn't being cleaned up correctly, but I think my code cleans everything possible. But either I am wrong, or the mere reference to MapPoint creates some type of wrapper that runs along with my application, or I have no idea what is going on.

    Smile.

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Or you could use a picture object (untested code).

    Code:
        Dim mpUtil As New MapPointUtilities.MapPointUtilities
        Dim pict As StdPicture
        Set pict = mpUtil.GetPictureFromObject(mpApp.ActiveMap)

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

    Doingit in VB.NET

    If you want to do it in VB.NET you might run in to trouble (as I did), so here's what you do there:

    Add a class to your project (remember to add a reference to stdole):
    Code:
    Public Class ConvertImage
        Inherits System.Windows.Forms.AxHost
        Public Sub New()
            MyBase.New("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
        End Sub
    
        Public Shared Function ImageToIPicture(ByVal Image As System.Drawing.Image) As stdole.IPictureDisp
            ImageToIPicture = GetIPictureFromPicture(Image)
        End Function
    
        Public Shared Function IPictureToImage(ByVal Image As stdole.IPictureDisp) As System.Drawing.Image
            IPictureToImage = GetPictureFromIPicture(Image)
        End Function
    End Class
    And then call the code as this (having an imagebox on your form called Picture1):
    Code:
            Picture1.Image = ConvertImage.IPictureToImage(mpUtil.GetPictureFromObject(mpApp.ActiveMap))

  6. #6
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    have you tried to sleep a few seconds between the two saves? I have found that this helps to sometimes solve weird MP behaviour.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Rotate map programatically in MapPoint 2006
    By Banu in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 05-04-2006, 05:46 PM
  2. Ctrl+T (Data -> Territories...) programatically MapPoint
    By SheepWorrier in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-12-2005, 05:34 PM
  3. Can MapPoint programatically add a place (not a pushpin)?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 11-11-2003, 11:39 AM
  4. Error in programatically drawing radius rings in mappoint
    By Eamon in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-02-2003, 06:39 PM
  5. Is MapPoint capable of programatically returning a....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-18-2002, 05:27 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66