Advertisement

Getting Win32 Keyboard messages.

Started by May 02, 2001 01:45 AM
1 comment, last by gimp 23 years, 9 months ago
I need to get a list of keyboard \ mouse messages that have occured recently. For the peice of code im writing it would be messy to have anything to do with the applications global message handler. (It''s in a DLL) For simplicity, I was wondering if there was any way of retrieving keyboard \ mouse events manually. I''ve looked at the Win32 api''s for getting the -current- state but I''m looking for key up\down events and mouse relative movement. The mouse API''s sem to go half way and give access to a buffer of mouse positions. In case there is no cool answer I''ve started writing a bit of code to store the whole keyboard\mouse state then check for changes but I was hoping there might be a simpler way. Any thoughts? Chris
Chris Brodie
Ahh... I''ve found:

KeyboardProc
MouseProc
SetWindowsHookEx

looks promising...
Chris Brodie
Advertisement
you can use GetAsyncKeyState() & 0x8000;

the & 0x8000 check if the pressed bit is set.

and you can use that for mouse buttons too, just take a look at msdn

and now to get the mouse cursor position use

POINT mpt;
GetCursorPos(&mpt);

mpt.x
mpt.y

voila

i hope i helped!

Arkon
[QSoft Systems]

This topic is closed to new replies.

Advertisement