|
-
Dec 25th, 2004, 02:52 PM
#1
Thread Starter
Frenzied Member
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
Last edited by thegreatone; Dec 25th, 2004 at 05:01 PM.
Zeegnahtuer?
-
Dec 25th, 2004, 02:57 PM
#2
Banned
Re: More messed Senkeys coding... Help ?
dont use 2 timers.
use 1 timer and set its interval to 5000 (5 sex)
-
Dec 25th, 2004, 03:00 PM
#3
Thread Starter
Frenzied Member
Re: More messed Senkeys coding... Help ?
 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...
-
Dec 25th, 2004, 03:05 PM
#4
Banned
Re: More messed Senkeys coding... Help ?
sendkeys "{" & text1.text & "}"
-
Dec 25th, 2004, 03:07 PM
#5
Thread Starter
Frenzied Member
Re: More messed Senkeys coding... Help ?
 Originally Posted by _visual_basic_
sendkeys "{" & text1.text & "}"
Still no luck 
Thanks for helpin tho
-
Dec 25th, 2004, 03:14 PM
#6
Banned
Re: More messed Senkeys coding... Help ?
i know what the problem is hold on i will post the form soon
-
Dec 25th, 2004, 03:18 PM
#7
Banned
Re: More messed Senkeys coding... Help ?
-
Dec 25th, 2004, 03:24 PM
#8
Thread Starter
Frenzied Member
Re: More messed Senkeys coding... Help ?
 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 ?
-
Dec 25th, 2004, 03:26 PM
#9
Banned
Re: More messed Senkeys coding... Help ?
to generate a shortcut
^ stands for alt so ^A or ^+A im not sure what it was
-
Dec 25th, 2004, 03:33 PM
#10
Thread Starter
Frenzied Member
Re: More messed Senkeys coding... Help ?
 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
-
Dec 25th, 2004, 03:40 PM
#11
Re: More messed Senkeys coding... Help ?
it has to have focus for shortcut keys to work
-
Dec 25th, 2004, 04:22 PM
#12
Thread Starter
Frenzied Member
Re: More messed Senkeys coding... Help ?
 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 ?
-
Dec 25th, 2004, 04:42 PM
#13
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?
-
Dec 25th, 2004, 04:49 PM
#14
Thread Starter
Frenzied Member
Re: More messed Senkeys coding... Help ?
 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..
-
Dec 25th, 2004, 05:42 PM
#15
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
-
Dec 25th, 2004, 09:17 PM
#16
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
-
Dec 25th, 2004, 10:17 PM
#17
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
 Originally Posted by dglienna
i don't think he is talking about notepad. not sure what it is, though
... then what would this mean? ...
VB Code:
Private Appnum As Long
Private Sub Command1_Click()
Appnum = Shell("C:\WINDOWS\notepad.exe")
Timer2.Enabled = True
End Sub
-
Dec 25th, 2004, 11:04 PM
#18
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
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.
-
Dec 25th, 2004, 11:07 PM
#19
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
I guess we just have to wait until he responds ...
-
Dec 25th, 2004, 11:23 PM
#20
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 26th, 2004, 11:34 AM
#21
Thread Starter
Frenzied Member
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 ?
-
Dec 26th, 2004, 06:11 PM
#22
Re: Fixed code, still need help tho... SIMULATE REAL KEYBOARD COMMANDS
Checkout the example (keyboard animation) for SetKeyboardState API here.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 28th, 2004, 10:40 AM
#23
Thread Starter
Frenzied Member
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 ?
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
|