WOW this one seems to be a toughee...
I am trying to detect the mouse movement over an excel window using
hooks, and I can't see where I'm going wrong:
step 1: little DLL written that passes a handle into a method
StartHook, shown below...:
function StartHook(aHWnd : HWnd):string;stdcall;
begin
oLabel := aLabel;
aMouseHook := SetWindowsHookEx(WH_MOUSE, aMouseHookProc,
HInstance, bHWnd);
result := 'Mouse Hook started';
end;
step 2: test app whips through the existing windows using the below
code, and when it finds our excel spreadsheet calls the starthook
method:
procedure TForm2.Button1Click(Sender: TObject);
var
NextHandle: Hwnd;
NextTitle: array[0..260] of char;
nextClassname : array[0..260] of char;
begin
NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST);
while (NextHandle > 0) do
begin
GetWindowText(NextHandle, NextTitle, 255);
if copy(nextTitle,1,15) = 'Microsoft Excel' then
begin
messagedlg(StartHook(label1, NextHandle),mtInformation,
[mbOK],0);
break;
end;
NextHandle := GetWindow(NextHandle, GW_HWNDNEXT);
end;
end;
HOWEVER, even tho the hook is all tied in, the aMouseHookProc in the
dll is never fired.
WHAT THE HECK AM I DOING WRONG????
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/