Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can VB SendKeys to Keyboard

Status
Not open for further replies.

Standing

Mechanical
Joined
Jan 14, 2002
Messages
1,578
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?


Bradley
 
I believe that parentheses must be sent to SendKeys within braces. Your third line should read:
[tt]
SendKeys "{(}{ })", 1
[/tt]

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top