View Single Post

  #5 (permalink)  
Old 04-16-2004
Dazzer Dazzer is offline
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()
Reply With Quote