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 / C++ / MFC
  4. not getting messages

not getting messages

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 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
    cgreathouse
    wrote on last edited by
    #1

    I'm trying to add a context menu to a tray icon that appears when a user right clicks on it. I'm not getting any of the "click" messages in the window that is passed in NOTIFYICONDATA. I did notice one thing. I was using SPY++ to see if the parent window existed (it's a 0,0,0,0 invisible window). I right clicked on the window and then clicked properties. As soon as I did the window started receiving messages like crazy. Does anyone know what's going on and what I need to do to fix it? Here's some code snippets CTrayWindow trayWindow; // CTrayWindow derives publicly from CWnd trayWindow.CreateEx(0, AfxRegisterWndClass(NULL), "Tray Window", WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0); ... m_iconData.hWnd = trayWindow.GetSafeHwnd(); // m_iconData is a NOTIFYICONDATA m_iconData.uID = WM_MYMESSAGE; m_iconData.uCallbackMessage = WM_MYMESSAGE; m_iconData.uFlags = NIF_ICON | NIF_MESSAGE; Shell_NotifyIcon(NIM_ADD, &m_iconData); CTrayWindow is instantiated in my CWinApp::InitInstance() Thanks!

    M 1 Reply Last reply
    0
    • C cgreathouse

      I'm trying to add a context menu to a tray icon that appears when a user right clicks on it. I'm not getting any of the "click" messages in the window that is passed in NOTIFYICONDATA. I did notice one thing. I was using SPY++ to see if the parent window existed (it's a 0,0,0,0 invisible window). I right clicked on the window and then clicked properties. As soon as I did the window started receiving messages like crazy. Does anyone know what's going on and what I need to do to fix it? Here's some code snippets CTrayWindow trayWindow; // CTrayWindow derives publicly from CWnd trayWindow.CreateEx(0, AfxRegisterWndClass(NULL), "Tray Window", WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0); ... m_iconData.hWnd = trayWindow.GetSafeHwnd(); // m_iconData is a NOTIFYICONDATA m_iconData.uID = WM_MYMESSAGE; m_iconData.uCallbackMessage = WM_MYMESSAGE; m_iconData.uFlags = NIF_ICON | NIF_MESSAGE; Shell_NotifyIcon(NIM_ADD, &m_iconData); CTrayWindow is instantiated in my CWinApp::InitInstance() Thanks!

      M Offline
      M Offline
      Miszou
      wrote on last edited by
      #2

      I remember hearing something about setting the foreground window and posting NULL messages when you are finished with the menu... something like this:

      pWnd->SetForegroundWindow();
      pMenu->TrackPoupMenu(
      TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD,
      point.x, point.y, pWnd, NULL );
      pWnd->PostMessage( WM_NULL );

      Hope this helps, or points you in the right direction somehow...


      There are 10 kinds of people - those that get binary and those that don't.

      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