Page 1 of 1

GetAsyncKeyState

Posted: Wed Nov 07, 2018 10:41 am
by unixkd
Hi all

Any one with the idea on how to use GetAsyncKeyState API to determine the rbClick on any part of an ActiveX dialog box for contextmenu popup.

Thanks

Joe

Re: GetAsyncKeyState

Posted: Wed Nov 07, 2018 1:29 pm
by rdonnay
You can probably use the GetCursorPos API call.

You will need to use Alaska's Binary Access Package (see docs) to work with the POINT structure.

GetCursorPos function
09/25/2018
2 minutes to read
Retrieves the position of the mouse cursor, in screen coordinates.

Syntax

Copy
BOOL GetCursorPos(
LPPOINT lpPoint
);
Parameters
lpPoint

Type: LPPOINT

A pointer to a POINT structure that receives the screen coordinates of the cursor.

Return Value
Type: BOOL

Returns nonzero if successful or zero otherwise. To get extended error information, call GetLastError.

Re: GetAsyncKeyState

Posted: Wed Nov 07, 2018 2:57 pm
by Auge_Ohr
unixkd wrote:Any one with the idea on how to use GetAsyncKeyState API to determine the rbClick on any part of an ActiveX dialog box for contextmenu popup.
can you give a Sample what you want to do with GetAsyncKeyState :?:
https://docs.microsoft.com/en-us/window ... nckeystate

Re: GetAsyncKeyState

Posted: Thu Nov 08, 2018 1:04 pm
by patito
Hi

That way you can make your call

#INCLUDE "ot4xb.ch"
#INCLUDE "dll.ch"

Local i, key, cResponse

For i = 0 To 255
// We consult the value of the key by means of the Api. _
//If pressed returns -32767 and we show the value of i

// 'Consultamos el valor de la tecla mediante el Api. _
// Si se presionó devuelve -32767 y mostramos el valor de i

If @user32:GetAsyncKeyState(i) = -32767 // or DllCall("USER32.DLL",DLL_STDCALL, "GetAsyncKeyState" ,y )

MsgBox() //Virtual key code :" i , " The key pressed is : " Chr(i)
// "Código de la tecla virtual :" i ," La Tecla presionada es : " Chr(i)

End If
sleep(50) //use Timer1:Interval
Next
Endif


Best Regard
Héctor Pezoa

Re: GetAsyncKeyState

Posted: Wed Nov 14, 2018 8:16 am
by unixkd
Hi Hector

Code: Select all

DllCall("USER32.DLL",DLL_STDCALL, "GetAsyncKeyState" ,y )
What if the parameter y in your API called in the above code ?

Thanks

Joe