c# - WPF stop mouse down event gaining Application focus -


In WinForms, I used the following block of code to prevent the application being clicked on:

  Personal Connection WM_MOUSEACTIVATE = 0x0021; Private constant int MA_NactivityAndTat = 0x0004; Safe Override Zero WndProc (Ref message message) {if (m.msg == WM_MOUSEACTIVATE) {m.Result = (IntPtr) MA_NOACTIVATEANDEAT; Return; } Base.WandProc (Ref M); }  

Is there a choice in the WPF application on this? Can I use an HwndSource? Even so far I have this (only WM_MOUSEACTIVATE does not work as necessary and the app still focuses):

  Protected Override Zero OnSourceInitialized (EventArgs e) {Base.OnSourceInitialized (e); HwndSource source = PresentationSource.FromVisual (this) as HwndSource; Source.AddHook (WndProc); } Private ITPR WndProc (IntPtr hwnd, Int msg, IntPtr wParam, handled with IntPtr lParam, Riff Bull) {// handle message ... int WM_MOUSEACTIVATE = 0x0021; Int WM_LBUTTONDOWN = 0x0201; // 513in WM_LBUTTONUP = 0x0202; // 514-inch WM_LBUTTONDBLCLK = 0x0203; // 515 if (msg == WM_MOUSEACTIVATE || msg == MA_NOACTIVATEANDEAT || msg == WM_LBUTTONDOWN || msg == WM_LBUTTONUP || msg == WM_LBUTTONDBLCLK) {handled = true; } Return IntPtr.Zero; }  

How do I get the results of the message?

Using the solution:

  Private Intpat WndProc (IntPtr hwnd , Int msg, IntPtr wParam, IntPtr lParam, handled Riff Bull) {// handle message ... int WM_MOUSEACTIVATE = 0x0021; If (msg == WM_MOUSEACTIVATE) {handled = true; New ITPT return (MA_NOACTIVATEANDEAT); } Return IntPtr.Zero; }  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -