I want to capture window message in VFP, could someone please point me to the right direction..
I ran to one of the VB example below but got stuck on one of the function and don't know how to convert it to VFP code.
"AddressOf WindowProc" = ??? in VFP should it be WindowProc()???
please help.
VB code:
Declare Function SetWindowLong Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function CallWindowProc Lib "user32" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long,
Public Const GWL_WNDPROC = (-4)
Dim PrevProc As Long
Public Sub HookForm(F As Form)
PrevProc = SetWindowLong(F.hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WindowProc = CallWindowProc(PrevProc, hwnd, uMsg, wParam, lParam)
If uMsg = WM_DRAWCLIPBOARD Then
MsgBox "Clipboard changed ..."
End If
End Function
VFP Code:
DECLARE INTEGER SetWindowLong IN user32;
INTEGER hWnd,;
INTEGER nIndex,;
INTEGER dwNewLong
DECLARE INTEGER CallWindowProc IN user32;
INTEGER lpPrevWndFunc,;
INTEGER hwnd,;
INTEGER Msg, ;
INTEGER wParam
Public GWL_WNDPROC = -4
PrevProc = SetWindowLong(THISFORM.hwnd, GWL_WNDPROC, AddressOf WindowProc)
I ran to one of the VB example below but got stuck on one of the function and don't know how to convert it to VFP code.
"AddressOf WindowProc" = ??? in VFP should it be WindowProc()???
please help.
VB code:
Declare Function SetWindowLong Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function CallWindowProc Lib "user32" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long,
Public Const GWL_WNDPROC = (-4)
Dim PrevProc As Long
Public Sub HookForm(F As Form)
PrevProc = SetWindowLong(F.hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
WindowProc = CallWindowProc(PrevProc, hwnd, uMsg, wParam, lParam)
If uMsg = WM_DRAWCLIPBOARD Then
MsgBox "Clipboard changed ..."
End If
End Function
VFP Code:
DECLARE INTEGER SetWindowLong IN user32;
INTEGER hWnd,;
INTEGER nIndex,;
INTEGER dwNewLong
DECLARE INTEGER CallWindowProc IN user32;
INTEGER lpPrevWndFunc,;
INTEGER hwnd,;
INTEGER Msg, ;
INTEGER wParam
Public GWL_WNDPROC = -4
PrevProc = SetWindowLong(THISFORM.hwnd, GWL_WNDPROC, AddressOf WindowProc)