protected override void WndProc(ref Message m) { const Int32 HTCAPTION = 0x00000002; const Int32 MF_BYCOMMAND = 0x00000000; const Int32 MF_GRAYED = 0x00000001; const Int32 MF_DISABLED = 0x00000002; const Int32 SC_MOVE = 0xF010; const Int32 WM_NCLBUTTONDOWN = 0xA1; const Int32 WM_SYSCOMMAND = 0x112; const Int32 WM_INITMENUPOPUP = 0x117; switch (m.Msg) { case WM_INITMENUPOPUP: { if (m.LParam.ToInt32() / 65536 != 0) // 'divide by 65536 to get hiword { EnableMenuItem(m.WParam, SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); } break; } //cancels the drag this is IMP case WM_NCLBUTTONDOWN when m.WParam.ToInt32() == HTCAPTION: // Cancels any clicks on move menu case WM_SYSCOMMAND when(m.WParam.ToInt32()& 0xFFF0) == SC_MOVE: return; } base.WndProc(ref m); }
bool OnWM_MESSAGE256(ref System.Windows.Interop.MSG msg, ref bool handled) { // // add extra variables to observe with Debugger // IntPtr HWND, WParam, LParam; HWND = msg.hwnd; WParam = msg.wParam; LParam = msg.lParam; this.txt_HWND.Text = HWND.ToString(); this.txt_WParam.Text = WParam.ToString(); this.txt_LParam.Text = LParam.ToString(); this.txt_KeyData.Text = KeyInterop.KeyFromVirtualKey(WParam.ToInt32()).ToString();//keyData.ToString(); return(true); }
// Token: 0x06000045 RID: 69 RVA: 0x00002830 File Offset: 0x00001830 public override string ToString() { return(string.Format("msg=0x{0:x} ({1}) hwnd=0x{2:x} wparam=0x{3:x} lparam=0x{4:x} pt=0x{5:x}", (int)Message, Message, HWnd.ToInt32(), WParam.ToInt32(), LParam.ToInt32(), Point)); }