keybd_event for .NET?
-
What's the equivalent of the Win32 API
keybd_event
(orSendInput
) for .NET? Thanks, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
-
What's the equivalent of the Win32 API
keybd_event
(orSendInput
) for .NET? Thanks, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
-
What's the equivalent of the Win32 API
keybd_event
(orSendInput
) for .NET? Thanks, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
I had a similar question that I posted a couple of days ago, with mixed results. See thread: http://www.codeproject.com/script/comments/forums.asp?msg=466571&forumid=1649#xx466571xx I tried calling keybd_event from C# through an extern declaration, like this:
[DllImport("User32.dll")] private unsafe static extern void keybd_event(byte bVk, byte bScan, uint dwflags, ulong* dwExtraInfo);
For me, this works the first time but is flaky after that. I'm not sure why, but it's possible that the last two parameter types are off -- I wasn't exactly sure what to use there. -
I had a similar question that I posted a couple of days ago, with mixed results. See thread: http://www.codeproject.com/script/comments/forums.asp?msg=466571&forumid=1649#xx466571xx I tried calling keybd_event from C# through an extern declaration, like this:
[DllImport("User32.dll")] private unsafe static extern void keybd_event(byte bVk, byte bScan, uint dwflags, ulong* dwExtraInfo);
For me, this works the first time but is flaky after that. I'm not sure why, but it's possible that the last two parameter types are off -- I wasn't exactly sure what to use there.It's amazing that there isn't something equivalent to this in .NET already! I'm still hopeful that it's in there somewhere, but we just haven't located it. Anyway, I did a search using Google and got to this link: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=keybd_event&btnG=Google+Search&meta=group%3Dmicrosoft.public.dotnet.languages.csharp[^] The second link there shows one way to declare keybd_event inside the program: http://groups.google.com/groups?q=keybd_event+group:microsoft.public.dotnet.languages.csharp&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=1DQ6HJ7VCHA.1780%40cpmsftngxa10&rnum=2[^] I'll give that a shot, and I'll also dig a little more slowly into the .NET library to see if I can spot it. You'd have thought the Application class would have been the place, but nope. Thanks for your help, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
-
I don't know, but there is no rule that you can't use API's in .NET! :)
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma GandhiI know, but why reinvent the wheel? You'd think that something like this would already be there, somewhere... :~ Thanks, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
-
I had a similar question that I posted a couple of days ago, with mixed results. See thread: http://www.codeproject.com/script/comments/forums.asp?msg=466571&forumid=1649#xx466571xx I tried calling keybd_event from C# through an extern declaration, like this:
[DllImport("User32.dll")] private unsafe static extern void keybd_event(byte bVk, byte bScan, uint dwflags, ulong* dwExtraInfo);
For me, this works the first time but is flaky after that. I'm not sure why, but it's possible that the last two parameter types are off -- I wasn't exactly sure what to use there.My digging payed off!! :-) I found a class called
SendKeys
class in the System.Windows.Forms namespace. Not the most intuitive name, but hey, it's a lot better than that awful keybd_event. Regards, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
-
My digging payed off!! :-) I found a class called
SendKeys
class in the System.Windows.Forms namespace. Not the most intuitive name, but hey, it's a lot better than that awful keybd_event. Regards, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
cool enjoy :laugh:
-
My digging payed off!! :-) I found a class called
SendKeys
class in the System.Windows.Forms namespace. Not the most intuitive name, but hey, it's a lot better than that awful keybd_event. Regards, Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
I had a quick look at the SendKeys class but can you use that to send it remotely, I think that was what you wanted to do. I am also looking for remote components to can control terminals across a tellephone line, I found some cool stuff, but not key strokes or mouse events... Let me know if you need any other stuff... Leon v Wyk