private void OnRightClick(object sender, uint id) { if (id == this.m_id && this.m_contextMenu != null) { NotifyIconEx.POINT pOINT = new NotifyIconEx.POINT(); NotifyIconEx.GetCursorPos(ref pOINT); NotifyIconEx.SetForegroundWindow(NotifyIconEx.m_messageSink.Handle); object[] empty = new object[1]; empty[0] = EventArgs.Empty; this.m_contextMenu.GetType().InvokeMember("OnPopup", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, this.m_contextMenu, empty); NotifyIconEx.TrackPopupMenuEx(this.m_contextMenu.Handle, 64, pOINT.x, pOINT.y, NotifyIconEx.m_messageSink.Handle, IntPtr.Zero); } }
private static extern int GetCursorPos(ref NotifyIconEx.POINT point);