SendInput
-
Hi, I was woundering if some of the higher level C# programmers could help me with my code. I have read all the Doc. that i can find about it, But i still cant get it to fully work. If I comment out the keyboadx ref's the mouseclickx works fine. If I dont neather the mouseclickx nor the keyboardx works at all. I cant get the keyboardx to work in any fashion. I made a link to a paste it site because i didnt know how it it is looked at about paste long code in forums. http://rafb.net/p/bmuAVm81.html[^]
-
Hi, I was woundering if some of the higher level C# programmers could help me with my code. I have read all the Doc. that i can find about it, But i still cant get it to fully work. If I comment out the keyboadx ref's the mouseclickx works fine. If I dont neather the mouseclickx nor the keyboardx works at all. I cant get the keyboardx to work in any fashion. I made a link to a paste it site because i didnt know how it it is looked at about paste long code in forums. http://rafb.net/p/bmuAVm81.html[^]
Hi, the problem is with your INPUT struct; its original C definition has a union which puts MOUSEINPUT and KEYBDINPUT at the same location; yours has not, so the substructs are located sequentially. There is a way to mimic union behavior in C# using explicit offsets, but in this case it would be easier to come up with two different INPUT structs (say INPUTK and INPUTM), and two prototypes for SendInput accordingly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, the problem is with your INPUT struct; its original C definition has a union which puts MOUSEINPUT and KEYBDINPUT at the same location; yours has not, so the substructs are located sequentially. There is a way to mimic union behavior in C# using explicit offsets, but in this case it would be easier to come up with two different INPUT structs (say INPUTK and INPUTM), and two prototypes for SendInput accordingly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
And as usual, Luc has the answer. I wouldn't even have thought of checking the original structs.
My current favourite word is: Waffle Cheese is still good though.
-
And as usual, Luc has the answer. I wouldn't even have thought of checking the original structs.
My current favourite word is: Waffle Cheese is still good though.
:rose: when it fails no part is beyond suspicion...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, the problem is with your INPUT struct; its original C definition has a union which puts MOUSEINPUT and KEYBDINPUT at the same location; yours has not, so the substructs are located sequentially. There is a way to mimic union behavior in C# using explicit offsets, but in this case it would be easier to come up with two different INPUT structs (say INPUTK and INPUTM), and two prototypes for SendInput accordingly. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
Thank you for the reply. I have modifed my code serveral time to try to make the struct more like you said. but to no avail can i get it to work. this is the code I have this time. Let me know what you see wrong on this one.. Thank you very much Danzar http://rafb.net/p/uPx4EW73.html[^]
-
Thank you for the reply. I have modifed my code serveral time to try to make the struct more like you said. but to no avail can i get it to work. this is the code I have this time. Let me know what you see wrong on this one.. Thank you very much Danzar http://rafb.net/p/uPx4EW73.html[^]
Hi danzar, the way I read the documentation on KEYBDINPUT structure, you must specify a valid dwExtraInfo "Specifies an additional value associated with the keystroke. Use the GetMessageExtraInfo function to obtain this information" so I think your zero value is not good enough. BTW: I noticed the mouse struct is smaller than the keyboard struct, but the original INPUT has a union, so its size must accomodate the largest of them (once you try my INPUTM, it would fail if you don't take care of that!). :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google