[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

popup menu on an icon in the system tray

Posted on 1998-06-24
6
Medium Priority
?
368 Views
Last Modified: 2013-11-20
I create an icon in the system tray with:

tnd.uCallbackMessage      = MYWM_NOTIFYICON;
Shell_NotifyIcon(NIM_ADD,&tnd);

works fine...

LRESULT CMyDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message) {

    case MYWM_NOTIFYICON: //----- something happened on my icon in the system tray
        switch(lParam) {
        case WM_RBUTTONUP: //----- have to create a popup menu
            CMenu menu, *pPopup;
            CPoint point;

            VERIFY(menu.LoadMenu(IDR_SYSTRAY_POPUP_MENU));
            pPopup = menu.GetSubMenu(0);
            ASSERT(pPopup != NULL);
      
            GetCursorPos(&point);          

            pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
            break;
        }
        break;
    }
            
    return CDialog::WindowProc(message, wParam, lParam);
}

problem starts there:
when I right click on the icon, the menu appears, fine ! But this menu is supposed to disappear when I lButtonDown outside the menu...

the menu disappears only if I LButtonDown on my CMyDlg...

the style of this dlg is Modal, Popup, with no title bar & frame...

I am gratefull to the ones who wish to help me in my quest to a promised heaven...
0
Comment
Question by:amby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
6 Comments
 
LVL 1

Author Comment

by:amby
ID: 1318389
Edited text of question
0
 
LVL 1

Author Comment

by:amby
ID: 1318390
Edited text of question
0
 
LVL 1

Author Comment

by:amby
ID: 1318391
Edited text of question
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:amby
ID: 1318392
Edited text of question
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 240 total points
ID: 1318393
Set your dialog to the foreground before doing the trackpopupmenu:

  SetForegroundWindow();
  pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);

0
 
LVL 1

Author Comment

by:amby
ID: 1318394
Great !!

I had answers from 2 gurus of MFC !!!

I want to sleep with you too, like galfin...

PS: I would not have thought about that...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question