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);
Community
  • 1
  • 1
Vladimir Potapov
  • 2,347
  • 7
  • 44
  • 71
  • 1
    You used values as decimal but Spy++ used hexa. You need use prefix "0x", so instead of 20380001 you need to use 0x20380001 and instead of 20120001 you need to use 0x20120001 – cadi2108 Sep 10 '14 at 01:13
  • I tried with 0x20380001 to,but it just selecting the tabs like Alt was pressed,but there is no real event, i read that apllication read the keyboard with SetKeyboardState(),and it acually checking if button pressed sow combination Alt+e don't work ,any way i did this another way with clicking on tab that i need and it works.Thanx any way. – Vladimir Potapov Sep 10 '14 at 05:08

0 Answers0