I trying to send in my application right alt+C.
I tried do it following:
PostMessage(hWindow, WM_KEYDOWN, (IntPtr)0x0043, (IntPtr)0x0012);
Delay(1000);
PostMessage(hWindow, WM_KEYUP, (IntPtr)0x0043, (IntPtr)0x0012);
and
PostMessage(hWindow, WM_KEYDOWN, (IntPtr)0x0043, (IntPtr)0x0001);
Delay(1000);
PostMessage(hWindow, WM_KEYUP, (IntPtr)0x0043, (IntPtr)0x0001);
but it doesn't correctly. How should I used it?
Try sending WM_SYSKEYDOWN and WM_SYSKEYUP messages instead. They are generated when either F10 or ALT+somekey is pressed and released.
Yes, it's possible using PostMessage. I used program Spy++ (it's inside Visual Studio or you can download it http://mdb-blog.blogspot.com/2010/11/microsoft-spy-or-spyxx-for-download.html) I runed notepad.exe and Spy++, and used Function FindWindow to handle this notepad. Then I used Spy->LogMessages, in Tab Messages I cleared all and stay checkbox Keyboard and in output I checked Raw Message Parameters.
Then in notepad i pressed alt+1 and I noted values from Window Messages. I known now, where use WM_KEYDOWN, WM_KEYUP, WM_SYSKEYUP etc. and value lParam, wParam.
My function:
and for example for alt+1
Thank you for all help.
Interleave them, like