• Welcome to Valhalla Legends Archive.
 

SendKeys VB Function

Started by Mesiah / haiseM, February 07, 2003, 11:52 AM

Previous topic - Next topic

Mesiah / haiseM

Im using a command button to do the following:

shell "c:\windows\system32\telnet.exe", vbnormalfocus
sendkeys "o 127.0.0.1 6112"

but when it executes, it opens like 10 telnet windows, and all are blank except one, which says:
Quote127.0.0.1 6112o 127.0.0.1 6112o 127.0.0.1 6112o 127.0.0.1 6112o 127.0.0.1 6112
any ideas on what im doing wrong, or any other way to send keys to a program?
]HighBrow Innovations
Coming soon...

AIM Online Status: 

Grok

#1
you're probably calling function that contains that code 10 times.

Banana fanna fo fanna

#2
only shell once, on startup
also use appactivate

Mesiah / haiseM

#3
sendkeys is a built in vb function, and the code you see there is inside a command button, no where else, thats all the code there is, yet still opens 10 windows and shit..
]HighBrow Innovations
Coming soon...

AIM Online Status: 

K

#4
shell "c:\windows\system32\telnet.exe o 127.0.0.1 6112", vbnormalfocus

Sendkeys are really a bad idea. They never work how you want them to. If this opens 10 windows when called once, then you need to fix something greater.

Mesiah / haiseM

#5
ooo good idea, silly me. thnx
]HighBrow Innovations
Coming soon...

AIM Online Status: 

iago

#6
Test it in a command button instead of in Activate, then you KNOW for absolutely certain it's only happening once (maybe generating a new window counts as an activate somehow)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


ILurker

#7
SendKeys, "keyshere"
Your forgot the ","
 ;)

Mesiah / haiseM

#8
? why would i need that? and if thats alone in a line of code, that would probably be invalid syntax...
]HighBrow Innovations
Coming soon...

AIM Online Status: 

indulgence

#9
The better question is why you are using sendkeys instead of SendMessage...

SendKeys will send only to the window that is active... not necessarily the one you want it too... AppActivate will activate your window - however -- it will not necessarily keep focus
<3

Mesiah / haiseM

#10
i changed my code, i no longer use sendkeys.
]HighBrow Innovations
Coming soon...

AIM Online Status: