Alt+key not working with PostMessage(use32.dll)

0

I read this answer Link

It is exactly what i tring to do,i need to send postmessage Alt+'E' to winApp but it's not working i used Spy++ and duplicate Wparametr and Lparametr and build it with postmessage. I did the same but i can't get the Alt+E action.

Any one know where is my misstake? How to get Alt+E event/action form windows application?

Here Spy++ the first 5 rows i pressed and the second is my code.(see the diffrance in Lparametrs and extend and AltDown)

In Img you can see that my code send's different Lparam.

enter image description here

Here my code

private const uint WM_KEYDOWN = 0x0100;
private const uint WM_KEYUP = 0x0101;
private const uint WM_SYSKEYDOWN = 0x0104;
private const uint WM_SYSKEYUP = 0x0105;
private const int VK_MENU = 0x12;

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int PostMessage(int hWnd, UInt32 msg, int wParam, int lParam);
//Here i take all Lparametrs from Spy++
PostMessage(Main, WM_SYSKEYDOWN, VK_MENU, 20380001);
PostMessage(Main, WM_SYSKEYDOWN, 0x45, 20120001);
Thread.Sleep(1000);
PostMessage(Main, WM_SYSKEYUP, 0x45, 0xE0120001);
PostMessage(Main, WM_KEYUP, VK_MENU, 0xC0380001);
c#
postmessage
user32
asked on Stack Overflow Sep 4, 2014 by Vladimir Potapov • edited May 23, 2017 by Community

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0