|
-
May 6th, 2001, 08:52 AM
#1
Thread Starter
Hyperactive Member
Sub Classing
Why doesn't this do anything?
Form1
-----------------
Dim lpfnOld As Long
Private Sub Form_Load()
lpfnOld = SetWindowLong(Form1.hwnd, GWL_WNDPROC, AddressOf FrmWndProc)
End Sub
Private Sub Form_Unload(Cancel As Integer)
SetWindowLong Form1.hwnd, GWL_WNDPROC, lpfnOld
End Sub
Module1
-----------------
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Function FrmWndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
MsgBox "hello"
Select Case uMsg
Case WM_SETFOCUS
Form1.Caption = "Subclassed Form - Has Focus"
FrmWndProc = 0
Exit Function
Case WM_KILLFOCUS
Form1.Caption = "Subclassed Form - Lost Focus"
FrmWndProc = 0
Exit Function
End Select
FrmWndProc = CallWindowProc(lpfnOld, hwnd, uMsg, wParam, lParam)
End Function
This is the very first time I have tried this so I haven't got a clue.
-Thanks
W#Ć€V€® W¦|| ߀ W¦|| ߀, ÄÑÐ †#€®€ ¦§ ÑÖ†#¦Ñ6 ¥Öµ ©ÄÑ ÐÖ ÄßÖµ† ¦†, §Ö §¦† ßÄ©K, ®€|ÄX ÄÑÐ |€† ¦† #ÄÞÞ€Ñ.
(Whatever will be will be, and there is nothing you can do about it, so sit back, relax and let it happen.)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|