Click here to Skip to main content
15,178,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
İ'm sorry for my bad English
hi,

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
autoitx3.dll
it worked but it com component i have source code(c++) i need .net(vb.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 ?
Posted
Updated 9-Jan-12 0:27am
v4

Did you read the reference?
SendKeys.Send[^]

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

try
C#
SendKeys.Send( "{TAB}" );
   
Comments
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 vb.net 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 [ http://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx ].

For .Net you might try this one. [ http://inputsimulator.codeplex.com ]
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
I'm not sure this is a question for C# but if it is try using the key value
You can find them on http://msdn.microsoft.com/en-us/library/system.windows.forms.keys%28v=vs.71%29.aspx[^]

For TAB is 9.
   
Comments
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900