MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Mappoint in VB.NET MDI

This is a discussion on Mappoint in VB.NET MDI within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; We've been using an Access application for a while now which uses the SetParent API to pull a Mappoint window ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-30-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Mappoint in VB.NET MDI

We've been using an Access application for a while now which uses the SetParent API to pull a Mappoint window into an Access form.

I am now trying to recreate the program using VB.NET but I cant seem to get the Mappoint window into my .NET mdi parent window

Here is the code we had in our Access app

Code:
Public gappmp As New MapPoint.Application

Public ghwndMP As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
       (ByVal lpClassname As String, ByVal lpWindowName As String) As Long
        
Public Declare Function SetParent Lib "user32" _
       (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Code:
  Set gappmp = CreateObject("MapPoint.Application")
  
'Open map
    gappmp.NewMap "c:\Map\Map.ptt"
    gappmp.Visible = True
    gappmp.UserControl = True
    gappmp.PaneState = geoPaneNone

        For Each oToolbar In gappmp.Toolbars
            If oToolbar.Name = "Navigation" Or oToolbar.Name = "navigation" Then
                oToolbar.Visible = True
            Else
                oToolbar.Visible = False
            End If
        Next
        DoEvents

  'Get the handle of the MapPoint Window
  ghwndMP = FindWindow(vbNullString, "Map - Microsoft MapPoint Europe")
  
'pull map into access window and lose unnecassary toolbars
    SetParent ghwndMP, Me.hwnd
Does any one know how I can do a similar thing with vb.Net, i've tried it and by putting the code in the mdi's on load event and all it does is open the form and a mappoint window but it keeps them seperat (doesn't put the mappoint window in the mdi) clearly something is going wrong with the SetParent command but I have no idea what.

If any one has any ideas I would really appriciate hearing them.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 04-01-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Make sure that the ISMDIParent boolean property is set to True. This will make your main parent form for all MDI child forms. Be aware that it will turn the parent form to a dark grey color.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 04-01-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Sorry. the property you need is the ISMDIContainer of the main form
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 04-13-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Thanks for you help, I've tried this put I seem to be having some trouble returning the handle of my MDIContainer form and setting it to be the parent of the Mappoint application.

It appears that Me.hwnd is different in .Net but i'm unsure of what it should be instead.

Have you any ideas where I could be going wrong.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 04-16-2004
Senior Member
Green Belt
 
Join Date: Sep 2003
Posts: 103
Done it

If any one else needs to do anything similar what you need to do is first declare the following in your module

Code:
    Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Long
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
    Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Public Declare Auto Function FindWindowNullClassName Lib "user32.dll" Alias "FindWindow" (ByVal lpClassName As Integer,  ByVal lpWindowName As String) As Integer

    Public Const WS_CHILD = &H40000000
    Public Const GWL_STYLE = (-16)
    Public Const WS_VISIBLE = &H10000000

     Public gappmp As New MapPoint.Application
Then in the mdi containers on load event put
Code:
gappmp = CreateObject("MapPoint.Application")
gappmp.Visible = True
gappmp.UserControl = True
gappmp.PaneState = MapPoint.GeoPaneState.geoPaneNone

MpOpen = FindWindowNullClassName(0, "Map - Microsoft Mappoint Europe")

        Dim retval, retval2 As Long
        Dim formHandle As Integer
        formHandle = Me.Handle.ToInt32
        retVal = SetWindowLong(MpOpen, GWL_STYLE, WS_CHILD Or WS_VISIBLE)
        retval2 = SetParent(MpOpen, formHandle)
        
        Application.DoEvents()
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 03-28-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 1
Re: Mappoint in VB.NET MDI

Hi,

Suppose I have applications named "App1.exe" & "App2.exe" and they are running in my windows desktop. I am developing a VB.NET application named "App3.exe".

Is it possible for me to get windows that are displayed by App1.exe and App2.exe inside App3.exe window? I mean, i want to take control of how they are displayed on desktop. Also, i would like them to be inside my App3.exe windows. Is it possible?

Any clue? Pls!

Thanks
MR
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 03-31-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,094
Re: Mappoint in VB.NET MDI

Hi,

This has nothing to do with mappoint. I suggest you repost in one of the various .net newsgroups or forums. I think what you try to do is possible but not very easy to do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
mappoint, mdi, vbnet


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 06:38 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Flights to Tenerife South
For great value flights to Tenerife South check online at Holiday Hypermarket. Great weather, great watersports and a great holiday destination.

Flights to Italy
Find cheap flights to Italy on Travel Counsellors. A personal Travel Counsellor can help you plan flights and find accommodation in Italy.

Cape Town Cheap Flights
Thinking about visiting Cape Town. Cheap flights are hard to find unless you visit dealchecker.co.uk. We'll shop around so you don't have to.

Jamaica Holidays
Jamaica holidays give you the chance to enjoy the vibrant cultural heritage and wonderful laid back atmosphere of the Caribbean. Book here!

Turkey
Before booking a holiday to Turkey check out the ULookUBook travel guide. Find out about the rich culture in Turkey before you go there to help you to make the most of your holiday.

Travel Guides
As far as travel guides are concerned, your best move would be to check out our website at Travel.co.uk

Cheap holidays to Portugal
Enjoy a spectacular country at a fraction of the cost. Find information on cheap holidays to Portugal at On The Beach.


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