ش | ی | د | س | چ | پ | ج |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Option Compare Database
Public WinProcOld As LongPtr
(Public Function SubClassWnd(hwnd As LongPtr
( WinProcOld = SetWindowLongPtr(hwnd, GWL_WNDPROC, AddressOf WindProc
End Function
(Public Function UnSubclassWnd(hwnd As LongPtr
SetWindowLongPtr hwnd, GWL_WNDPROC, WinProcOld
WinProcOld = 0
End Function
'This is your subclassed window procedure
Public Function WindProc(ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr
'WM_COMMAND message is sent to parent window to notify of a button click
'The lParam parameter tells the hWnd of the button
'If wMsg = WM_CTLCOLORBTN Then WindProc = CreateSolidBrush(RGB(0, 0, 10))
If wMsg = WM_COMMAND Then
If lParam = GetDlgItem(hwnd, 4) Then MsgBox "Button was clicked!"
If lParam = GetDlgItem(hwnd, 1) Then MsgBox "Button was clicked!"
End If
If wMsg = WM_DESTROY Then
UnSubclassWnd hwnd
End If
WindProc = CallWindowProc(WinProcOld, hwnd, wMsg, wParam, ByVal lParam)
End Functionc