CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    72

    System Tray Icon Question

    I have added the icon to the system tray, but how can I tell if the user right clicks on the icon? How about if they left click it?

    Thanks,
    Nathan Standberg


  2. #2
    Join Date
    Apr 1999
    Location
    Germany
    Posts
    37

    Re: System Tray Icon Question

    Hi Nathan.

    When creating the tray icon you can specify a callback message that will be send
    to your window when the user clicks (or whatever) on your icon.

    See: NOTIFYICONDATA m_nid;
    m_nid.cbSize = sizeof(m_nid);
    m_nid.hWnd = this->m_hWnd;
    m_nid.uID = 1;
    m_nid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
    m_nid.uCallbackMessage = WM_TASKBAR; // <--- The message
    strTip.LoadString(IDS_TIP);
    strcpy(m_nid.szTip, strTip);
    m_nid.hIcon = m_hIcon = AfxGetApp()->LoadIcon(IDI_ACTIVE);

    All you've got to do now is catch the message and react in a proper way:


    Hope this helps

    Regards Ronny







Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured