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

好久不见. 提交于 2019-12-25 03:48:15

问题


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.

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);

来源:https://stackoverflow.com/questions/25659399/altkey-not-working-with-postmessageuse32-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!