SendInput
- From: "Jon M. Gohr" <jongohr@xxxxxxxxxxxxxxxx>
- Date: Tue, 13 Sep 2005 08:16:12 -0500
Referencing Paul DiLascia's January 2005 C++ Q&A article here:
http://msdn.microsoft.com/msdnmag/issues/05/01/CQA/
He's using SendInput from C++ in the following manner:
static void SendString(LPCTSTR str) {
INPUT inp[2];
memset(inp,0,sizeof(INPUT));
inp[0].type = INPUT_KEYBOARD;
inp[0].ki.dwFlags = KEYEVENTF_UNICODE; // to avoid shift, and so on
inp[1] = inp[0];
inp[1].ki.dwFlags |= KEYEVENTF_KEYUP;
for (LPCTSTR p=str; *p; p++) {
inp[0].ki.wScan = inp[1].ki.wScan = *p;
SendInput(2, inp, sizeof(INPUT));
}
}
I've seen simple C# Interop examples of SendInput (like the one from
pinvoke.net) but none that works with KEYEVENTF_UNICODE. Anyone know how to
get this working properly in C#? I would ideally like something exactly the
C++ SendString method above. I've already tried SendKeys and it doesn't work
correctly for my needs.
Thanks for any help you can provide!
.
- Prev by Date: Re: Simply Call a method from a OCX?
- Next by Date: Service hangs when accessing ActiveX control
- Previous by thread: Please help: Cannot invoke methods of a COM object
- Next by thread: Service hangs when accessing ActiveX control
- Index(es):