Valhalla Legends Forums Archive | Visual Basic Programming | simulateing key pressing

AuthorMessageTime
Tontow
How do you simulate a key press? (ie: left and right arrow keys)
April 8, 2005, 10:52 PM
KkBlazekK
The SendKeys Function might be what you are looking for.
April 9, 2005, 12:37 AM
Null
You might have to select the window u want to send them to aswell?
April 9, 2005, 6:15 AM
Stealth
If they're inside your own program, just call the _KeyPress or _KeyDown event for the object you want the keys to be pressed on. You may need to experiment (ie Debug.Print KeyAscii) to figure out what the arguments should be.
April 9, 2005, 6:14 PM
Yegg
[quote author=effect link=topic=11219.msg107961#msg107961 date=1113027331]
You might have to select the window u want to send them to aswell?
[/quote]
The SendKeys function will work like a macro, it just sends keys to the computer as if you were typing them in through your keyboard. What window is being focused on will be the one that receives the keys.
April 9, 2005, 6:20 PM
Adron
If you want to send keys to non-active windows, you can sometimes use SendMessage or PostMessage with WM_KEYDOWN, WM_KEYUP and/or WM_CHAR.
April 9, 2005, 6:27 PM
Yegg
It just matters on what the purpose of his program is. Whether it be built to send key strokes to specific programs, or if it functions like a macro.
April 10, 2005, 11:21 PM
Grok
Tontow did anyone answer your question?  Some asked for more information.  How about do the community a favor and say you got your answer (maybe even which method you chose) or answer their questions so they can help you.
April 11, 2005, 7:51 PM
NetNX
Alot of programs(games) protect agienst bots and that nature by disabling the sendkeys function in their program... not sure about those other methods but maybe you could create a fake keyboard device and make a program that causes this fake device to send keys ( just a though ) i mean like not a physical device i mean like a driver that can be manipulated by a program
April 20, 2005, 2:43 PM
Yegg
Even though many games (Runescape, Eternal Lands) have protection from automated tasks by 3rd party programs, I highly doubt that they can stop the SendKeys function from your program. SendKeys sends keys directly to the computer as if you were typong them through your keyboard. Nothing can detect if you are typing or if it is a program.
April 20, 2005, 6:37 PM
NetNX
[quote author=Yegg link=topic=11219.msg109170#msg109170 date=1114022261]
Even though many games (Runescape, Eternal Lands) have protection from automated tasks by 3rd party programs, I highly doubt that they can stop the SendKeys function from your program. SendKeys sends keys directly to the computer as if you were typong them through your keyboard. Nothing can detect if you are typing or if it is a program.
[/quote]

You oviously dont know what your talking about then... We will use something i recently worked on as an example Guildwars you can download the client from their site http://guildwars.com make a code that will log you in completely and prove me wrong using only the sendkeys api
April 21, 2005, 2:41 PM
Yegg
Why would I want to waste my time proving you wrong? I'm working on other projects.
April 21, 2005, 3:26 PM
Adron
[quote author=Yegg link=topic=11219.msg109280#msg109280 date=1114097218]
Why would I want to waste my time proving you wrong? I'm working on other projects.
[/quote]

Maybe you are wrong. Maybe you're ignorant. Maybe you lose?
April 21, 2005, 5:21 PM
Yegg
Maybe not?
April 22, 2005, 1:46 PM
Quarantine
Since you're not going to take your time I guesss you will never know and will be assume wrong :p
April 22, 2005, 2:24 PM
LivedKrad
Failure to answer a challenge based off of a previous statement made by yourself makes you wrong?

Well, my Algebra 2 teacher is in for some exciting new interpretations of our conversations. Thanks for the tip, Adron.
April 23, 2005, 12:08 AM
Ban
Um, what?
April 25, 2005, 2:52 PM
Adron
[quote author=LivedKrad link=topic=11219.msg109509#msg109509 date=1114214882]
Failure to answer a challenge based off of a previous statement made by yourself makes you wrong?

Well, my Algebra 2 teacher is in for some exciting new interpretations of our conversations. Thanks for the tip, Adron.
[/quote]

Absolutely. A math teacher should be able to prove all the theorems being taught or be able to point to existing proofs if the proof is too long to write on the blackboard. Math teachers should never rely on saying: "This is the way it, because I say so", because then they're turning math into something as vague as religion - based on belief and speculation.
April 25, 2005, 3:02 PM
QwertyMonster
In my maths lesson, im the best in it :P

The teacher explains it, but then i go into more detail than she can, and the class listen carefully, and say "No i dont understand what the teacher says", but when i explain they say, "Yes i kind of understand this".

If i feel my teacher hasn't explained it well, i will explain it back to her in more detail. My maths teacher (Is a she) is actually very good.
April 25, 2005, 3:30 PM
Yegg
I learn more from http://math.com than school math classes.
April 27, 2005, 8:24 PM
LivedKrad
[quote author=Adron link=topic=11219.msg109847#msg109847 date=1114441344]
[quote author=LivedKrad link=topic=11219.msg109509#msg109509 date=1114214882]
Failure to answer a challenge based off of a previous statement made by yourself makes you wrong?

Well, my Algebra 2 teacher is in for some exciting new interpretations of our conversations. Thanks for the tip, Adron.
[/quote]

Absolutely. A math teacher should be able to prove all the theorems being taught or be able to point to existing proofs if the proof is too long to write on the blackboard. Math teachers should never rely on saying: "This is the way it, because I say so", because then they're turning math into something as vague as religion - based on belief and speculation.
[/quote]

My Chemistry teacher frequently says such things. Apparently, if we get an answer wrong on the test but the answer book says otherwise, weare completely wrong and there is no room for discussion or for proving the answer false.

"I thought you said the delta H of a substance was its exothermic or endothermic temperature change.."

"The answer is A, damnit!"
April 27, 2005, 8:58 PM
Adron
Sounds like you've been given simplified explanations. Besides, there's a huge difference between math and chemistry!
April 28, 2005, 2:30 AM
LivedKrad
Agreed. There is a substantial difference between math and chemistry in most areas, however the teaching styles at my school for chemistry and math are one in the same: don't ask don't tell.
April 28, 2005, 3:01 AM
Adron
You should try asking your math teacher for more proofs. Since math is based purely on theory, you can generally prove things. Unlike chemistry which is somewhat empirical.
April 28, 2005, 1:49 PM
Tontow
How would I send the keys to a single program regardless of weather it was full screen or minimized?

What about data injection? - (Note: I have no clue what data injection is)

BTW, I'm not makeing a cheating micro bot, I'm trying to make a tourney program that can interface with and send text through any or most game clients, but I'm focusing on getting it to work with starcraft first. - kinda like that one program that truned your starcraft into a moderation bot.
May 9, 2005, 8:17 PM
Myndfyr
[quote author=Tontow link=topic=11219.msg111730#msg111730 date=1115669823]
How would I send the keys to a single program regardless of weather it was full screen or minimized?

What about data injection? - (Note: I have no clue what data injection is)

BTW, I'm not makeing a cheating micro bot, I'm trying to make a tourney program that can interface with and send text through any or most game clients, but I'm focusing on getting it to work with starcraft first. - kinda like that one program that truned your starcraft into a moderation bot.
[/quote]

[quote author=Adron link=topic=11219.msg107987#msg107987 date=1113071223]
If you want to send keys to non-active windows, you can sometimes use SendMessage or PostMessage with WM_KEYDOWN, WM_KEYUP and/or WM_CHAR.
[/quote]

(I realize that this thread has gone way off-topic, but you could have looked through the responses ;))
Both SendMessage and PostMessage are documented in MSDN.
May 9, 2005, 9:52 PM
Yegg
I'm sure pscode.com and vbcode.com have some perfect examples on doing this.
May 10, 2005, 3:00 AM

Search