VB实现,调用及操作应用程序

'使用shell调用的dll。

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

'Text1.Text为用户名;Text2.Text为密码。
Private Sub test_Click()
'设定test登陆过程:调用test,用sendkeys发送
Dim RetVal
RetVal = Shell("D:\test.exe", 1)   ' 完成Calculator。
Sleep 5000 '表示延时5秒
DoEvents
'SendKeys "+{tab}"
SendKeys Text1.Text
SendKeys "{tab}"
SendKeys Text2.Text
SendKeys "{enter}"
End Sub

你可能感兴趣的:(VB实现,调用及操作应用程序)