Sending WM_CONTEXTMENU
-
I'm trying to send a WM_CONTEXTMENU message to an NotifyIcon control, hoping to pop open the context menu. Am I totally off base with the following code? Needless to say, since I am posting to this forum, it isn't working. // Send message to open context menu Message m = new Message(); m.Msg = WM_CONTEXTMENU; // Get notify icon native window Type t = this.notifyIcon1.GetType(); NativeWindow icon = ((NativeWindow)t.GetField("window", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this.notifyIcon1)); // Create message m.HWnd = icon.Handle; m.WParam = icon.Handle; Int16 high = Convert.ToInt16(this.m_ptLeftClick.X); Int16 low = Convert.ToInt16(this.m_ptLeftClick.Y); m.LParam = (IntPtr)((Int32)(high << 16) + low); // Send message icon.DefWndProc(ref m);