Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to hide systray menu Collapse All
Subject Author Date
lester oidka Jun 30, 2006 - 12:23 PM

I use popup menu after user clicks on systray icon of my app. However if there’s no selected item in menu the menu hides in like 10 seconds even if user clicks on other windows. I use the same way in other app with non-profuis menu and it works fine.
I don§t know what to set to make it work properly

Here’s my code:

    POINT pt;
    GetCursorPos(&pt);

    // Create tray menu
    CMenu menu;

    menu.LoadMenu (IDR_MENU_TRAY);

    CExtPopupMenuWnd *pop = new CExtPopupMenuWnd ();
    pop->UpdateFromMenu ( GetSafeHwnd (), &menu, true, true, false);
    pop->g_bMenuExpanding = false;
    pop->g_bMenuHighlightRarely = false;

    if (!pop->TrackPopupMenu (TPM_BOTTOMALIGN, pt.x, pt.y, 0))
    {
        delete pop;
    }

Technical Support Jul 3, 2006 - 10:50 AM

It is not completely clear what the problem is. Your code should work without any problem. Would you send us your project or give more clear explanation of the problem?

lester oidka Jul 4, 2006 - 1:35 AM

I need to see some (very easy) sample of usage menu which is opened from a systray icon. My systray menu doesnůt work correctly. It opens and if you select something from it everything is ok BUT ifyou just click on the systray icon the menu shows but doesn’t hide until you select something from it. I mean you can open the menu and then work with another program, watch movie and the menu would still be there. Correct behavior is when menu hides if any other app is selected.

-------------------------------------------------------------------------------------

By the way I’ve already solved it ;]

this->SetForegroundWindow();

had to be called for a parent window...

Technical Support Jul 4, 2006 - 11:02 AM

You solved the problem correctly. You should invoke the SetForegroundWindow() API for any window created in the same thread which tracks and handles the popup menu displayed from the system tray. This is necessary to make the message processing work correctly and this necessary both for standard and Prof-UIS menus displayed from the system tray. Unfortunately, as a result, the previously active application gets inactive. You can see that the pressed button in the task bar becomes normal indicating that all applications in the task bar are in the inactive state. It is not possible to avoid changing the active application when tracking the popup menu from the system tray.