Currently have an application is to use the rawinput handle mouse and keyboard, I want to simulate the WM_INPUT mouse messages sent, but no response, is excuse me this does not support across processes to send, if injected into the target process?
CodePudding user response:
https://www.cnblogs.com/songr/p/5467007.html
CodePudding user response:
Your code?
CodePudding user response:
WM_INPUT response is as follows: simulate a (lParam HRAWINPUT)
case WM_INPUT: { UINT dwSize; GetRawInputData (lParam HRAWINPUT, RID_INPUT, NULL, & amp; DwSize, sizeof (the RAWINPUTHEADER)); LPBYTE LPB=new BYTE [dwSize]; If (LPB==NULL) { return 0; }
If (GetRawInputData (lParam HRAWINPUT, RID_INPUT, LPB, & amp; DwSize, sizeof (the RAWINPUTHEADER))!= DwSize) OutputDebugString (TEXT (" GetRawInputData doesn 't return correct size! \ n "));
The RAWINPUT * raw=(*) the RAWINPUT LPB;
If (raw - & gt; The header. DwType==RIM_TYPEKEYBOARD) { If (raw - & gt; Data. The rid_device_info_keyboard. Message==WM_KEYDOWN) { if (! IsInKeys (raw - & gt; Data. The rid_device_info_keyboard. VKey)) { Char keytext [10]={0}; BYTE state [256]={0};
//is obtained by the virtual keyboard code name ToAscii (raw - & gt; Data. The rid_device_info_keyboard. VKey, raw - & gt; Data. The rid_device_info_keyboard. MakeCode state, (LPWORD) keytext, 0); Char buf [10]={0}; String s="keyboard press the virtual key code:" + string (keytext); MessageBoxA (NULL, s.c _str (), "keyboard", MB_OK); } }
If (raw - & gt; Data. The rid_device_info_keyboard. Message==WM_KEYUP) { Erasekey (raw - & gt; Data. The rid_device_info_keyboard. VKey); } } The delete [] LPB; return 0; }//end case WM_INPUT