SubClassing MDI form

Phil
11-02-2000, 10:45 AM
Hi All,

I've subclassed the MDI form of my app. in order to control its resizing and it works well thanks to the help of Jared (my previous post - WM_SIZING).

The problem I have is that when running my code from the IDE, when I exit the program the project IDE exits as well. I can comment-out the calls to the hook and unhook proceedures when developing and it works fine when compiled so its not a tremendous worry but if anyone could suggest why this is happening it'd be greatly appreciated. The code is as follows:

Public Sub apMapperHook()
lpPrevMapperWndProc = SetWindowLong(gMapperHW, GWL_WNDPROC, AddressOf MapperWindowProc)
End Sub

Public Sub apMapperUnhook()
Dim temp As Long

temp = SetWindowLong(gMapperHW, GWL_WNDPROC, lpPrevMapperWndProc)
End Sub

Private Function MapperWindowProc(ByVal hw As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

If uMsg = WM_GETMINMAXINFO Then
'Call proceedure that fills MINMAXINFO structure with my
'settings then redirect to default window proceedure
Call MsgReceived(lParam)
MapperWindowProc = DefWindowProc(hw, uMsg, wParam, lParam)
Else
MapperWindowProc = CallWindowProc(lpPrevMapperWndProc, hw, uMsg, wParam, lParam)
End If

End Function

apMapperHook is called from the MDI form load event and apMapperUnHook is called from the MDI form queryUnload event.

BillSoo
11-02-2000, 12:34 PM
I haven't looked into why this is happening on your system but I have a suggestion:

Instead of commenting out your code, use a global variable to enable/disable it.

Then set the value of this variable using the commandline arguments.

Then add the argument to the project properties. This way, the code can automatically be disabled when running from the IDE but run normally when compiled. As a bonus, if it ever acts up on someone elses system, you can tell them to add the command line argument to disable it.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

Phil
11-03-2000, 04:47 AM
Hi

Thanks for the tip hadn't thought of using Command Line arguments, very good. Thats solved the immediate problem, still would like to know why it's happening though if anyone has any ideas.

Thanks
Phil

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum