PDA

Click to See Complete Forum and Search --> : subclassing wm_sizing event


skullb
Jul 19th, 2000, 01:36 PM
I`m designing a form that has "minimum" size after which the form will not get resized .. I`m not gonna dwell why I
subclass it but the problem I have is that after I intercept the wm_resize and ignore it it still resizes ..
I think I`m missing something just can`t figure out what ...

SUB MODULE
---------------------------------------------------------
Public Sub StartSubclassing(ByVal hWnd As Long)
saveHWnd = hWnd
oldProcAddr = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WndProc)
End Sub

Public Sub StopSubclassing()
SetWindowLong saveHWnd, GWL_WNDPROC, oldProcAddr
End Sub

Public Function WndProc(ByVal hWnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
WndProc = CallWindowProc(oldProcAddr, hWnd, uMsg, wParam, lParam)
Select Case uMsg
Case WM_SIZING
If rolled = False Then 'resize otherwise dont
PostMessage hWnd, WM_SIZING, 0
End If
End Select
End Function
----------------------------------------------------------
form_load
StartSubclassing Me.hWnd

form_unload
StopSubclassing