|
-
Aug 6th, 2001, 10:16 PM
#1
Thread Starter
New Member
Question to "sendkeys"
Hello,
I use sendkeys to simulate a key-press to antother application. It works fine.
Now, I need the simulation of pressing Ctrl+Enter at the same time. How can I do this? It doesn´t works at this time. I tried ^{ENTER} and ^({ENTER}), and ^~ and ...
Can some one help me?
The other simulation is: shift+Ctrl+right arrow. And all this at the same time.
Do you have an idea?
Greetings Jochen
PS: The application is a videocutting programm, and i like to simulate the funktions "transition, fast forward, render, ....
-
Aug 6th, 2001, 10:39 PM
#2
PowerPoster
Something like this does control enter!
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyShift) <> 0 And GetAsyncKeyState(vbKeyReturn) <> 0 Then
Call addnew 'this is my sub. put your function all or
'whatever here
End If
End Sub
Hows that?
-
Aug 6th, 2001, 11:01 PM
#3
-= B u g S l a y e r =-
I tested the Ctrl Enter combination with this code
VB Code:
Private Sub Command2_Click()
Text1.SetFocus
SendKeys "^{ENTER}"
End Sub
worked just fine.
-
Aug 7th, 2001, 12:06 AM
#4
For multiple keys, you can use the keybd_event API function.
VB Code:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As _
Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal _
dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2
Const VK_SHIFT = &H10
Const VK_CONTROL = &H11
Private Sub Command1_Click()
keybd_event VK_SHIFT, 0, 0, 0
keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_CONTROL, 0, 0, 0
keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0
keybd_event vbKeyRight, 0, 0, 0
keybd_event vbKeyRight, 0, KEYEVENTF_KEYUP, 0
End Sub
-
Aug 7th, 2001, 01:01 PM
#5
Thread Starter
New Member
Hello together,
thanks for the reply.
Beacon:
I think you understood me wrong. i wouldn´t press the keys on the keyboard, i will simulate this by clicking a command button
Peet:
SendKeys "^{ENTER}" looks fine. Works very good, and so simple. Thank you
Matthew:
I have a code like this:
Private sub command1_click()
appactivate "Microsoft Word"
sendkeys {RIGHT}
end sub
now, i would instead the keypress "right arrow" press a combination like this: hold down shift key, hold down ctrl key, press once right arrow and release the shift and ctrl keys when the mousebutton comes up.
Can you explain me, if this is done by your code? I don´t understand the function of your code. Can you put remarks at each line and describe what the line is doing?
Best greetings
Jochen from Germany
(Sorry for my english)
-
Aug 7th, 2001, 03:00 PM
#6
VB Code:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As _
Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal _
dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2
Const VK_SHIFT = &H10
Const VK_CONTROL = &H11
Private Sub Command1_Click()
AppActivate "Microsoft Word"
DoEvents
keybd_event VK_SHIFT, 0, 0, 0
keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_CONTROL, 0, 0, 0
keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0
keybd_event vbKeyRight, 0, 0, 0
keybd_event vbKeyRight, 0, KEYEVENTF_KEYUP, 0
End Sub
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
|