Have you tried something simple like
dim TargetAppName as String
.....
TargetAppName = "calc.exe"
.....
AppActivate Shell(TargetAppName, 1)
Have you tried something simple like
dim TargetAppName as String
.....
TargetAppName = "calc.exe"
.....
AppActivate Shell(TargetAppName, 1)
Keith
www.diyha.co.uk
www.kat5.tv
Hi,
Under most circumstances, SendKeys is not recommended in a production environment.
This is because the keystrokes are processed by whichever window is currently active
on the desktop. Obviously this will cause unpredictable behavior in case another app
receives the focus while your code is processing the Sendkeys statement.
If you're unlucky, the keystrokes sent to application may cause all documents
to be deleted or the hard drive to be formatted.
So try to avoid Sendkeys at all cost.
Best regards,
Luciano
Luciano, The whole reason for this application is to send keystrokes to an application.
Keith, That's how the Help file does it, I had shrunk it down a bit for testing.
I was hoping there was a sort of 'list' feature of running applications that I could scroll through; something like ALT-TAB. But now that I think more about it, similar applications make the user select the executable (like the Profiler for the Logitech wheel). By forcing focus on a selected executable, I reduce that danger that Luciano brought up.
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
I ended up storing the executable, at least it works.
Any idea why this is seen by a game:
SendKeys "{F3}", False
But this is not:
SendKeys "{LEFT}", False
The Help file lists the Left Arrow as a special character just like F3, but it doesn't work for some reason.
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Yes, but games also use keyboard input.
I found several good tutorial links on a gaming site:
http://www.vbtutor.net/vbtutor.html
http://cuinl.tripod.com/tutorials.htm
http://www.vbcode.com/
http://www.planet-source-code.com/
Not sure if they were mentionned above.
One guy in those tutorials recommended using the SendInput feature instead of the "basically broken" SendKeys.
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
I'm starting to see what people have moaned about MS products. Most of the links I've read relating with SendKeys says that it is not reliable, if it works at all.
This place describes using a more flexible keyboard API:
http://www.vbaccelerator.com/home/VB...PI/article.asp
Still reading, how it's understandable.
Robert
![]()
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Bookmarks