Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subclassing MDI parent problem

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
I'm new to subclassing and I'm having a problem applying it to an MDI parent form. It works perfectly for MDI children and modal forms, but it always causes VB to close when the program ends and the MDI parent unloads.

In the MDI Form Load event I've got:
PrevWndProc = SetWindowLong(hwnd, -4, AddressOf FormResizeWndProc)

In the MDI Form Unload event I've got:
A& = SetWindowLong(hwnd, -4, PrevWndProc)

(where PrevWndProc is a form-defined variable)

While the program is running it correctly intercepts the events I'm interested in (wm_size for example) - in fact it all works fine until it tries to unhook from the subclass handler, at which point the program closes and VB closes too.

Is an MDI Parent a special case? Am I doing something obviously wrong?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Are you sure you have the variable PrevWndProc declared in the general declaration section of the form?
 
Yep.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top