If I comment out "contact.show", which is the parent it works fine, but of course that is necessary. I tried putting an unload for the openfiledialog right before "contact.show", but it wouldnt unload it
Public Sub Hook()
'Establish a hook to capture messages to this window
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _
AddressOf WindowProc)
End Sub
Public Sub Unhook()
Dim temp As Long
'Reset the message handler for this window
temp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
End Sub
Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
'Check for the ActivateApp message
If uMsg = WM_ACTIVATEAPP Then
'Check to see if Activating the application
If wParam <> 0 Then
Contact.Show
' which_screen
End If
End If
'Pass message on to the original window message handler
WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, _
lParam)
End Function
Here is the loadform for "Contact"
Private Sub MDIForm_Load()
Dim i As Integer
Dim Msg As String
Dim ScaleFactorX As Single, ScaleFactorY As Single ' Scaling factors
Dim objcontrol As Control
On Error GoTo ErrHandler
'Store handle to this form's window
gHW = Me.hwnd
Screen.MousePointer = 99
' Size of Form in Pixels at design resolution
DesignX = 800
DesignY = 600
RePosForm = True ' Flag for positioning Form
DoResize = False ' Flag for Resize Event
' Set up the screen values
Xtwips = Screen.TwipsPerPixelX
Ytwips = Screen.TwipsPerPixelY
Ypixels = Screen.height / Ytwips ' Y Pixel Resolution
Xpixels = Screen.Width / Xtwips ' X Pixel Resolution
' Determine scaling factors
ScaleFactorX = (Xpixels / DesignX)
ScaleFactorY = (Ypixels / DesignY)
Resize_For_Resolution ScaleFactorX, ScaleFactorY, 0, 0, 12000, 9000, Me
MyForm.height = Me.height ' Remember the current size
MyForm.Width = Me.Width
screen_res = DesignX / (Screen.Width / Screen.TwipsPerPixelX)
resX = 4300 / screen_res
resY = 4150 / screen_res
resRad = 3900 / screen_res
Load Cntrls
SetParent Cntrls.hwnd, Picture1.hwnd
Cntrls.Show
'Call procedure to begin capturing messages for this window
Hook
Unload Open_file
'Initialize variables
files_open = 0
filled.file0 = False
filled.file1 = False
filled.file2 = False
filled.file3 = False
filled.file4 = False
dragging = False
sect = "rect"
GMT = False
stat_change = "polar"
start_dir = CurDir
xt = resX
yt = resY
Exit Sub
ErrHandler:
Msg = "ERROR " & Err.Description
MsgBox Msg
Exit Sub
End Sub