-
Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Ok, i basically want to send the contents of Text1 to the program defined as Appnum the sending will be done by a timer (every 5 minutes...) where in my code have i gone wrong ?
VB Code:
Private Appnum As Long
Private Sub Command1_Click()
Appnum = Shell("C:\WINDOWS\notepad.exe")
Timer2.Enabled = True
End Sub
Private Sub Timer2_Timer()
Timer1.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer()
AppActivate Appnum
SendKeys (Text1.Text)
End Sub
-
Re: More messed Senkeys coding... Help ?
dont use 2 timers.
use 1 timer and set its interval to 5000 (5 sex)
-
Re: More messed Senkeys coding... Help ?
Quote:
Originally Posted by _visual_basic_
dont use 2 timers.
use 1 timer and set its interval to 5000 (5 sex)
The first timer in that codee is their so that it activates the second timer...
I know the timer work, i don't need help on that, its just the problems with the sendkeys...
-
Re: More messed Senkeys coding... Help ?
sendkeys "{" & text1.text & "}"
-
Re: More messed Senkeys coding... Help ?
Quote:
Originally Posted by _visual_basic_
sendkeys "{" & text1.text & "}"
Still no luck :(
Thanks for helpin tho :)
-
Re: More messed Senkeys coding... Help ?
i know what the problem is hold on i will post the form soon
-
Re: More messed Senkeys coding... Help ?
-
Re: More messed Senkeys coding... Help ?
Quote:
Originally Posted by _visual_basic_
fully functional
Yay, that does work, BUT, when modified to open another app it DOES send the keys, BUT as the other app ONLY responds to real keyboard shortcuts how do i make it act as if it came from the keyboard ?
-
Re: More messed Senkeys coding... Help ?
to generate a shortcut
^ stands for alt so ^A or ^+A im not sure what it was
-
Re: More messed Senkeys coding... Help ?
Quote:
Originally Posted by _visual_basic_
to generate a shortcut
^ stands for alt so ^A or ^+A im not sure what it was
Yeah i know that, i mean it only seems to work from actual key presses not VB simulated ones :(
-
Re: More messed Senkeys coding... Help ?
it has to have focus for shortcut keys to work
-
Re: More messed Senkeys coding... Help ?
Quote:
Originally Posted by dglienna
it has to have focus for shortcut keys to work
Lol, i kno... is there any way to actually simulate the command from the keyboard to the program, as in, when u press a key it sends the same signal as the one runnin down the ps/2 port ?
-
Re: More messed Senkeys coding... Help ?
you'd have to find out what it was sending before you could send it. try sending all 256 of them to see which one is correct? you could end up getting lucky?
-
Re: More messed Senkeys coding... Help ?
Quote:
Originally Posted by dglienna
you'd have to find out what it was sending before you could send it. try sending all 256 of them to see which one is correct? you could end up getting lucky?
Lol, that may take some time... if only i could find someone who had already done this.. :(
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Is this what you need, thegreatone?
VB Code:
Private Sub Command1_Click()
Dim i%
Shell "notepad", vbNormalFocus
Clipboard.Clear
With Text1
For i = 0 To Len(.Text) - 1
SendKeys Mid(.Text, i + 1, 1)
Next i
End With
SendKeys "^{c}"
SendKeys "^{v}"
End Sub
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
i don't think he is talking about notepad. not sure what it is, though
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Quote:
Originally Posted by dglienna
i don't think he is talking about notepad. not sure what it is, though
... then what would this mean? ... :confused:
Quote:
VB Code:
Private Appnum As Long
Private Sub Command1_Click()
Appnum = Shell("C:\WINDOWS\notepad.exe")
Timer2.Enabled = True
End Sub
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Quote:
BUT, when modified to open another app it DOES send the keys, BUT as the other app ONLY responds to real keyboard shortcuts how do i make it act as if it came from the keyboard ?
AND
...same signal as the one runnin down the ps/2 port
I wasn't sure what he meant, either.
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
I guess we just have to wait until he responds ... :)
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
You can use the keybd_event API to send keypreses or mouseclicks to
a window that you can make active and focused.
VB Code:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
An example at allapi.net
HTH
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Sorry i took so long to reply, so far the closest thing to what i am trying to do is posted by robdog, BUT i am still far from acheiving what i am wanting to do.
Ok, i am really trying to make this understandable, so here goes :
When you press a key on your keyboard a signal is sent through the wire to the computer, i want a Visual Basic program to be able to simulate that exact thing. This program MUST be able to make the computer think a key is bieng pressed somehow, and the API and sendkeys features do not do this. Am i aiming far too high for a VB program ?
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Checkout the example (keyboard animation) for SetKeyboardState API here.
-
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
The API does ntohing for me, it doesn't even affect the keyboard lights, needless to say, i think this really would work if it was modified, and then i would have exactly what i wanted, so, anyone want to try and make the example coding work for me ?