With the sendmessage
This is the mouse hook DLL code inside the
LRESULT CALLBACK KeyboardProc (int nCode, WPARAM WPARAM, LPARAM LPARAM)
{
If (nCode==HC_ACTION) {
Lparam MSLLHOOKSTRUCT * PKBHS=(MSLLHOOKSTRUCT *);
SendMessage (glhWnd WM_MYMSG, PKBHS - & gt; Pt. X, PKBHS - & gt; Pt. Y);
}
Return CallNextHookEx (glhHook, nCode wparam, lparam);//continue to send messages
}
This is exe
LRESULT CGetMouseExeDlg: : OnMYMSG (WPARAM WPARAM, LPARAM LPARAM)
{
Cstrings STR.
STR. The Format (_T (" X: Y % d: % d ", wParam, lParam));//formatting the mouse coordinates information and save to the cstrings type variable STR
GetDlgItem (IDC_EDIT1) - & gt; SetWindowText (STR);//update the program window text Edit control
return 1;
}
Want to show a great god and baa has a fault,,,
CodePudding user response:
Baidu search relevant keywords,CodePudding user response:
1: hook installation is successful? When installing hooks dwThreadId is 0?2: if (nCode & gt;=HC_ACTION) in the DLL OutputDebugString output debugging information to see if successful?
VC6 MSDN examples include complete SPY++ source can under reference
CodePudding user response:
Add the log debug to a file, to see whether the hook can get normal mouse events related notice, and then see if your exe can receive your hooks sent messages,