|
-
May 3rd, 2007, 12:06 AM
#1
Thread Starter
Lively Member
Sendkeys alternate?
Hi.
Im using Sendkeys to send keystrokes within my VB app. However, its not too reliable, and skips out on instances. Is there a more reliable, (free) alternate for Sendkeys that can be used in a VB6 app?
Thanks
-
May 3rd, 2007, 12:08 AM
#2
Re: Sendkeys alternate?
there is an API available for sending keystrokes...just google for that, you will get examples here in VBF
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
May 3rd, 2007, 12:26 AM
#3
Re: Sendkeys alternate?
When using sendkeys, make the wait parameter to True and use Sleep() function to make it more reliable sort of putting a little delay before firing the next sendkeys.
Sample
Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
SendKeys "{F2}", True 'sending F2 keys and wait for the process to finish before firing the next sendkeys
Sleep 100
SendKeys "^{C}", True
'... etc etc
this is some lame tricks if you dont want to use the API sendkeys.
-
May 3rd, 2007, 12:37 AM
#4
Fanatic Member
Re: Sendkeys alternate?
Most often the problems with Sendkeys are timing related (as zynder pointed out)
PS
MS has guaranteed that VB6 apps would run ok in Vista
But I am hearing that Sendkeys has problems, and MS does not give a sh....
So if some kind sole can post a complete alternative module, it would be great.
Last edited by RobCrombie; May 3rd, 2007 at 12:41 AM.
Rob C
-
May 3rd, 2007, 12:44 AM
#5
Frenzied Member
Re: Sendkeys alternate?
Why are you using SendKeys within your own program? What exactly are you doing with it?
-
May 3rd, 2007, 12:53 AM
#6
Re: Sendkeys alternate?
SendKeys is the worst VB function ever made 
Seriously, you can use the keybd_event API to simulate keypresses but it like SendKeys relies upon the receiving object to have the input focus.
SendMessage and PostMessage APIs are the most reliable and durable functions for sending keypresses or what not.
SendKeys does not work when trying to send keys to IE7.
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 
-
May 3rd, 2007, 12:55 AM
#7
Re: Sendkeys alternate?
Some sort of spammer i assume? Anyway i know for one in a "Storm.dll" there is a function which is ten times better than SendKeys but i forget what it was.
-
May 3rd, 2007, 12:57 AM
#8
Frenzied Member
Re: Sendkeys alternate?
Agreed, Sendkeys is awful.
Especially if you are sending commands to your own program, it is not necessary.
-
May 3rd, 2007, 12:59 AM
#9
Re: Sendkeys alternate?
Maybe its a language issue here. Probably the poster means to send key strokes from within his application to some other destination.
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 
-
May 3rd, 2007, 01:08 AM
#10
Frenzied Member
Re: Sendkeys alternate?
I certainly hope so :|
Can we get the original poster to help us out and ease our blood pressure yet?
-
May 3rd, 2007, 06:53 AM
#11
Thread Starter
Lively Member
Re: Sendkeys alternate?
Original poster here.
Yes, i mucked up with the grammar there. Im trying to get my VB app to send keystrokes to another application. Basically, its a datafeed Im getting in the form of a bunch of invoices. What im trying to do is capture the prices of a certain object from the invoices, and send it to another application.
There may be other ways ot do it, but i want to use keystrokes, since that is quick in my case, and i will be needing the keystrokes in other areas of this app as well. So any alternate to sendkeys would be much appreciated.
-
May 3rd, 2007, 07:06 AM
#12
Hyperactive Member
Re: Sendkeys alternate?
Hi style, I recently used sendkeys to control another program from VB6. I got it to work reliably, but only after ZYNDER's suggestion posted above. Add that TRUE word at the end of your string (makes VB6 wait for other program to respond before sending next key) and put loads of sleep delays inbetween sets of keystrokes. I started with sellp 100's, but eventually was able to reduce to sleep 10's - but every program will tend to be different. Unless you are in a big hurry for this thing to work, the longer the delays the better has been my recent experience.
ca moore
-
May 3rd, 2007, 11:18 AM
#13
Re: Sendkeys alternate?
But with scenerios like using SendKeys and even the keybd_event API you are tieing up your system as you can not disturb the active application.
If you use SendMessage/PostMessage you can have the automation running in the background while you can continue to work or post here at VBF
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 
-
May 3rd, 2007, 11:38 AM
#14
Lively Member
Re: Sendkeys alternate?
i agree with Rob u can use sendmessage or postmessage api
-
May 3rd, 2007, 12:28 PM
#15
Hyperactive Member
Re: Sendkeys alternate?
Thank you, noted by contributor ca Moore. I am, relative to you folk, a novice at VB but usually I find some waqy to overcome problems (with the help of forum!) albeit not the most elegant.
CAM
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
|