Getting Mouse Coordinates
Posted on 2003-03-20
I need a way of detecting the mouse position globally - regardless of what is under the mouse. At present, I use this code:
function MouseProc(nCode: Integer; wParam: Longint; var MouseHookStruct:
TMouseHookStruct): Longint; stdcall;
Result := CallNextHookEx(MouseHook, nCode, wParam, Longint(@MouseHookStruct));
procedure TMainForm.FormShow(Sender: TObject);
MouseHook := SetWindowsHookEx(WH_Mouse, @MouseProc, 0, GetCurrentThreadId);
It works fine, except for if I drop a TMediaPlayer on the form and link it too a panel. When the mouse cursor moves over the area that is playing the video, I no longer recieve mouse events.
Can anyone tell me how I can get this working?