Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Ctrl+Shift keypress
Message
From
07/01/2009 02:32:05
Reza Meamar
Homa Programming Group
Shiraz, Iran
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01371451
Message ID:
01371584
Views:
12
Dear Peter,
now i understand that "The GetKeyState function retrieves the status of the specified virtual key" and i can "Use from it in program to easily determine whether a keyboard key or mouse/joystick button is currently down or up".
thanks for your guide.
Now please say to me how i can simulating these (Ctrl+ Left Shift and Ctrl+ Right Shift) with pressing button on my form.
Thank you very much

>From Winuser.h :
>
>/*
> * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
> * Used only as parameters to GetAsyncKeyState() and GetKeyState().
> * No other API or message will distinguish left and right keys in this way.
> */
>#define VK_LSHIFT 0xA0
>#define VK_RSHIFT 0xA1
>#
>
>>Hi all,
>>I have a form with a RichTextBox on it.
>>I want to have two command button LTRCMD and RTLCMD.
>>I put below code in LTRCMD Click Event:
>>
>>#define VK_CONTROL 0x11  && CTRL key  
>>#define VK_LSHIFT  160  && Left SHIFT key  
>>#define VK_RSHIFT  161  && Right SHIFT key  
>>#define KEYEVENTF_KEYUP  2
>>#define KEYEVENTF_EXTENDEDKEY  1 
>>
>>DECLARE INTEGER keybd_event IN Win32API INTEGER, INTEGER, INTEGER, INTEGER
>>
>>thisform.olerTF.SetFocus
>>      
>>keybd_event( VK_CONTROL,  0, 0 , 0 ) && ctrl key down
>>keybd_event( VK_LSHIFT,    0, 0 , 0 ) && Left Shift key down
>>
>>keybd_event( VK_CONTROL,  0, KEYEVENTF_KEYUP, 0 ) 
>>keybd_event( VK_LSHIFT,    0, KEYEVENTF_KEYUP, 0 )
>>
>>and below code in RTLCMD Click event :
>>
>>#define VK_CONTROL 0x11  && CTRL key  
>>#define VK_LSHIFT  160   &&0x2A  && Left SHIFT key  
>>#define VK_RSHIFT  161   &&0x36  && Right SHIFT key  
>>#define KEYEVENTF_KEYUP  2
>>#define KEYEVENTF_EXTENDEDKEY  1 
>>
>>DECLARE INTEGER keybd_event IN Win32API INTEGER, INTEGER, INTEGER, INTEGER
>>
>>thisform.olerTF.SetFocus
>>      
>>keybd_event( VK_CONTROL,  0, 0 , 0 ) && ctrl key down
>>keybd_event( VK_RSHIFT,    0, 0 , 0 ) && Right Shift key down
>>
>>keybd_event( VK_CONTROL,  0, KEYEVENTF_KEYUP, 0 ) 
>>keybd_event( VK_RSHIFT,    0, KEYEVENTF_KEYUP, 0 )
>>
>>when i press LTRCMD, all thing is good, but when i press RTLCMD ? NOTHING !
>>where i am wrong?
>>Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform