Home > Net >  C # PostMessage failed to release the left mouse button
C # PostMessage failed to release the left mouse button

Time:10-05

After executing the following code,
[DllImport (" user32. DLL, "EntryPoint=" PostMessageA ")]
Private static extern int PostMessageA (IntPtr HWND, int wMsg, IntPtr wParam, IntPtr lParam);

Public static void SendMsg (int x, int y, IntPtr hWnd)
{
//by pressing the left mouse button
Public const int WM_LBUTTONDOWN=0 x0201;
//release the left mouse button
Public const int WM_LBUTTONUP=0 x0202;
PostMessageA (hWnd WM_LBUTTONDOWN, (IntPtr) MessageConstant. MK_LBUTTON, (IntPtr) (y * 65536 + x));
PostMessageA (hWnd WM_LBUTTONUP, (IntPtr) MessageConstant. MK_LBUTTON, (IntPtr) (y * 65536 + x));
}
Application is click on the location of the App icon, the long press not loosen condition, but if I by click on the location of the mouse, the normal open, feel like release the mouse left key operation is affected by the actual mouse position, want to please your bosses have what good method, namely the implementation background click and does not affect the operation of the front desk,

CodePudding user response:


After finishing point is that the strange appearance, the mouse if you do not enter the range should be remained in this state

CodePudding user response:

CodePudding user response:

Help, help! Bosses
  •  Tags:  
  • C#
  • Related