|
-
Dec 5th, 2000, 05:19 PM
#1
Thread Starter
New Member
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.
-
Dec 5th, 2000, 05:30 PM
#2
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
-
Dec 5th, 2000, 05:33 PM
#3
Frenzied Member
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
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 5th, 2000, 06:39 PM
#4
Thread Starter
New Member
Thanks guys
_____________
Fried Chicken
Don't bother
me! I'm gaining
weight! :| DUHHH
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
|