Click here to Skip to main content
14,238,485 members
Rate this:
Please Sign up or sign in to vote.
See more:
İ'm sorry for my bad English

i need sendkeys examples
i found
sendinput method
sendkeys method
sendmessage method

all methots press virtual key but game protected this
example for Knight Online
Sendkeys.Send("a") etc. work
Sendkeys.Send("{TAB}") doesn't work
only tab doesn't work

i found
it worked but it com component i have source code(c++) i need .net( or c#)
it isn't useful
auto keybot it work very well but i haven't source code
Windows Virtual Keyboard is work
ı have to send real key on keyboard(kernel) not virtual(user32) !

Help me please ?
Updated 8-Jan-12 23:27pm
Rate this:
Please Sign up or sign in to vote.

Solution 3

Did you read the reference?

Probably you used the wrong syntax. Instead of
SendKeys.Send( "TAB" );
// or
SendKeys.Send( "9" );

SendKeys.Send( "{TAB}" );
mixtapes 8-Jan-12 10:22am
Unfortunately, not
SvenMe 8-Jan-12 11:26am
Hm, then I'm sorry.

Just an idea. You said you gonna send these keys to a game. Most games I know show a scoreboard while pressing the TAB key. Maybe sending the key once isn't enough.

Another question would be, if you're wrapping your code into a try-catch block and suppressing the exception? I mean something like that:

try { SendKeys.Send( "YourKey" ); } catch {}
mixtapes 9-Jan-12 5:28am
i tried it
not worked
only sendkeys.send("{TAB}") or sendkeys.send{&H9}
mixtapes 9-Jan-12 10:47am
I found something
i send tab key in c++ project
but or c# can't do it

can you build class library in c++ (sendkey.dll)
i need reference it my c# project ???
SvenMe 9-Jan-12 11:32am
If you want to use your C++ project, you have to do it via PInvoke [ ].

For .Net you might try this one. [ ]
mixtapes 9-Jan-12 11:41am
i don't understand .net not worked in game
do you have com dll ? imputsimulator(c/c++)
SvenMe 9-Jan-12 11:53am
Did you even read what I wrote?

You said you tried a C++ project and it worked. So, why don't you use this library or whatever in your project? I gave you a link to a pinvoke tutorial.

The InputSimulator is wrapping the SendInput method of the Windows API. It is the same method you probably use in your C++ library (and the same System.Windows.Forms.SendKey uses).

I still think you're doing something wrong in your code but without more information it is hard to help...
mixtapes 9-Jan-12 12:13pm
i cant't do it i don't know c++ but this work pffff
Rate this:
Please Sign up or sign in to vote.

Solution 1

I'm not sure this is a question for C# but if it is try using the key value
You can find them on[^]

For TAB is 9.
mixtapes 7-Jan-12 15:24pm
thanks for anwer but didn't work i tried it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100