Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch if shift key pressing at toolbar buttons click met
Message
From
08/03/2014 17:32:17
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
 
To
08/03/2014 12:58:27
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595966
Message ID:
01595973
Views:
75
Likes (1)
Thank you,

Just one mistake, it's good with an untested code:

WAIT WINDOW "Shift keys: " + IIF(BITAND(lnResultL, 0x8000)#0, "Left ", SPACE(0)) +;
IIF(BITAND(lnResultR, 0x8000), "Right"#0, SPACE(0))


I'll do just save at form with click and save and exit with shift+click. It'll be good...


>>Hi All,
>>Is there a way catch if shift key pressing at toolbar buttons click method?
>
>
>You can always obtain the state of the any of the keyboard keys at any time by using the GetAsyncKeyState() WIN32 function:
>http://msdn.microsoft.com/en-us/library/windows/desktop/ms646293%28v=vs.85%29.aspx
>
>The codes you would pass to it are (untested, but something similar should work :-)):
>
>
#define VK_LSHIFT 0xA0    && Left SHIFT key
>#define VK_RSHIFT 0xA1    && Right SHIFT key
>
>DECLARE SHORT GetAsyncKeyState IN USER32.DLL INTEGER nVKey  && Virtual key-code
>
>lnResultL = GetAsyncKeyState(VK_LSHIFT)
>lnResultR = GetAsyncKeyState(VK_RSHIFT)
>
>WAIT WINDOW "Shift keys: " + IIF(BITAND(lnResultL, 0x8000), "Left ", SPACE(0)) + IIF(BITAND(lnResultR, 0x8000), "Right", SPACE(0))
>
>
>If you do this as the first operation of your click() event, the shift key will likely still be down so the return value will be valid in that case (if you can't check it any other way).
>
>Here are codes also for Shift, Control, and Alt:
>
#define VK_LSHIFT 0xA0    && Left SHIFT key
>#define VK_RSHIFT 0xA1    && Right SHIFT key
>#define VK_LCONTROL 0xA2  && Left CONTROL key
>#define VK_RCONTROL 0xA3  && Right CONTROL key
>#define VK_LMENU 0xA4     && Left ALT key
>#define VK_RMENU 0xA5     && Right ALT key
>
>
>The other virtual key codes are here:
>http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
>
>You can also obtain the system mouse position similarly using GetCursorPos() (http://msdn.microsoft.com/en-us/library/windows/desktop/ms648390%28v=vs.85%29.aspx ) but it requires some more complex extraction to obtain the offsets. See the post I wrote in my message history about the UTC to Local time for the algorithms to extract the 16-bit portions.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform