Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Sending WM_CONTEXTMENU

Sending WM_CONTEXTMENU

Scheduled Pinned Locked Moved C#
c++question
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cmaissan
    wrote on last edited by
    #1

    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);

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups