Hi,

I create forms with VB 6.0 for use as child windows of MI-Map windows. The problem is that when I want to drag the VB-Form, as soon as I click on it it moves down : distance beetween mouse-pointer and top of form equivalent to the distance beetween top of map window and top of screen.
Here is an example with a blank form: VB project consists of a module, a form and must reference the MI OLE automation type library : the above code has to be pasted into a module (start-up module), and a form (here named EmptyForm) has to be added to the project. It creates a MI-Application, which opens a map-table, and a child-form is added to this map.

Public Mi As MapInfoApplication
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Sub Main()

        Dim MIHandler As Long
        Dim X As Long
        Dim MIAppHandler As Long

        Set Mi = CreateObject("MapInfo.Application")
        Mi.Visible = True
        Mi.Do ("Open Table ""{Path of a MI-Table}"" Interactive")
        Mi.Do ("Map From {Name of table}")
        EmptyForm.Visible = True
        MIHandler = Mi.Eval("WindowID(1)")
        MIAppHandler = Mi.Eval("WindowInfo(" & CStr(MIHandler) & ", 12)")
        X = SetParent(EmptyForm.hwnd, MIAppHandler)
 
End Sub

How is it possible to prevent this problem ?

Regards,

Vincent




--------------------------------------------------------------------------------
* Vincent Mottier                                EPFL- SWISS FEDERAL INSTITUTE *
* E-Mail:[EMAIL PROTECTED]                      OF TECHNOLOGY - LAUSANNE *
* Phone : 41+21 693 37 33                  Soil and Water Management Institute *
* Fax : 41+21 693 37 39                             Ecublens  CH-1015 LAUSANNE *
--------------------------------------------------------------------------------

Reply via email to