Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Mar : Detect RightMouseButton Pressed

www.cryer.info
Managed Newsgroup Archive

Detect RightMouseButton Pressed

Subject:Detect RightMouseButton Pressed
Posted by:"Dave Atkin" (sepultur..@optusnet.com.au)
Date:Fri, 25 Mar 2005 10:39:38

Hi everyone,

I need to test for a Right MouseButton click in a procedure that does not
have any Mouse Events as arguments.
in order to allow or prevent editing depending on which MouseButton was
pressed.
Using the following code:

RetVal := GetKeyState(VK_RBUTTON);

The function returns -127 the first time it's called, -128 the second time,
followed by -127, -128, etc.. the return value alternates between -127
& -128 for each call.  Can anyone explain this?

I can test like this:

bNoEdit := Abs(RetVal) in [127..128];

But I'm sure there is a better way...
Any ideas?

Best regards,
Dave Atkin

Replies:

www.cryer.info
Managed Newsgroup Archive