|
-
Sep 14th, 2000, 06:46 PM
#1
=====================================================
Hiii Guys
I want to use sendkeys function to send
Ctrl+RightShift to any control.
I used sendkeys "^{RSHIFT}" and "^{RIGHTSHIFT}",but in all it was error occured.
Can some body help me please?
With Regards.
======================================================
-
Sep 14th, 2000, 07:00 PM
#2
Lively Member
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more
of the following codes.
Key Code
SHIFT +
CTRL ^
ALT %
MSDN Doc.
C/C++,Delphi, VB6,Java,PB (blech!),ASP,JSP,SQL...bla bla bla and bla
I love deadlines. I like the whooshing sound they make as they fly by.
—Douglas Adams
-
Sep 14th, 2000, 07:17 PM
#3
SendKeys cannot distinguish Left and Right shift, hence, you can use PostMessage() as a work around.
(NOTE: This will only work in Windows NT)
Code:
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const VK_RSHIFT = &HA1
Private Const WM_CHAR = &H102
Private Sub Command1_Click()
PostMessage Text1.hwnd, WM_KEYDOWN, VK_RSHIFT, 0
PostMessage Text1.hwnd, WM_CHAR, VK_RSHIFT, 0
PostMessage Text1.hwnd, WM_KEYUP, VK_RSHIFT, 0
End Sub
-
Sep 14th, 2000, 07:35 PM
#4
hitcgar, that's not quite what he wants to do. He wants to click the right shift.
Try this:
Code:
Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As _
Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Private Const VK_RSHIFT = &HA1
Private Sub Command1_Click()
dwnrshift% = SendMessage(hwnd, WM_KEYDOWN, VK_RSHIFT, 0)
dwnrshift% = SendMessage(hwn, WM_KEYUP, VK_RSHIFT, 0)
End Sub
(Fix the &H100 to make it work correctly)
-
Sep 14th, 2000, 07:45 PM
#5
Matthew: SendMessage will not work because it does not return directly. Use PostMessage instead.
-
Sep 14th, 2000, 08:52 PM
#6
Oh.
By the way, the reason I posted that was because I hit post reply, and went to look for an answer, and it took me about 20 minutes to find it and I saw that you posted. But thanks again for another tip Megatron .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|