Can VB SendKeys to Keyboard
Can VB SendKeys to Keyboard
(OP)
We use a black box to switch from one computer to another using the same monitor and keyboard. I am trying to write a VB 6 code to do this from an icon on the desktop. So far the program looks like the following:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub PushKeys Lib "KeyPush" (ByVal Keystrokes As String)
Private Sub cmdBlackBox_Click()
SendKeys "{SCROLLLOCK}", 1
SendKeys "{SCROLLLOCK}", 1
SendKeys "( )", 1
End Sub
It does not work. Does anyone have any ideas?
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub PushKeys Lib "KeyPush" (ByVal Keystrokes As String)
Private Sub cmdBlackBox_Click()
SendKeys "{SCROLLLOCK}", 1
SendKeys "{SCROLLLOCK}", 1
SendKeys "( )", 1
End Sub
It does not work. Does anyone have any ideas?
Bradley





RE: Can VB SendKeys to Keyboard
SendKeys "{(}{ })", 1
If you're using SendKeys (native to VB) then you may not need the PushKeys declaration, which belongs to a non-VB (external) dll.
I'm sure that you are aware that SendKeys cannot send to a non-Windows app.
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting