-
Hay,
I'm wondering how to make Wndows 98 think that somebody has pressed a key on the keyboard with VB6. I've figured out how to move and click the mouse, now i just need to know how to simulate typing on the keyboard.
Thx,
Fried Chicken
_______________
Don't bother
me. I'm eating.
-
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_KEYDOWN = &H100
Private Sub Command1
'Press the "A" key
SendMessage MyHwnd, WM_KEYDOWN, vbKeyA, 0
End Sub
-
You could try SendKeys or try the KeyB_Event:
Code:
'SendKeys
Private Sub Form_Activate()
SendKeys "HELLO", True
End Sub
Code:
'Keybd_Event
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
Private Sub Form_Activate()
TypeChar vbKeyH
TypeChar vbKeyE
TypeChar vbKeyL
TypeChar vbKeyL
TypeChar vbKeyO
End Sub
Private Sub TypeChar(Char As Long)
keybd_event Char, 0, 0, 0
keybd_event Char, 0, KEYEVENTF_KEYUP, 0
End Sub
-
Thanks guys
_____________
Fried Chicken
Don't bother
me! I'm gaining
weight! :| DUHHH