Article View: microsoft.public.vb.winapi
Article #5Tray Menu with Visible main window?
From: breeze
Date: Tue, 27 Oct 1998 00:00
Date: Tue, 27 Oct 1998 00:00
83 lines
3793 bytes
3793 bytes
Follow up question: The method described in Q135788 below works fine when the application has no visible Main window. But if it has a Main window visible when right-clicking the tray icon, the Menu will just flash up briefly and instantly disappear again. Anyone has a solution to this? Obviously there is some workaround possible here, too (since e.g. right-clicking the clock application in the system tray after first having double-clicked up its main window works OK), but I havent been able to figure out a nice solution... /Breeze In article <eKgBa1N$9GA.201@uppssnewspub05.moswest.msn.net>, "Timothy Legge" <tlegge@fundy.net> wrote: > Below is a MS Knowledgebase, that addresses problem two. > > >2) My pop-up window does not disappear if I click on another window. I > will > >only disappear if I move back over the menu after I have clicked on another > >window. > > http://support.microsoft.com/support/kb/articles/q135/7/88.asp > > PRB: Menus for Notification Icons Don't Work Correctly > Last reviewed: May 21, 1998 > Article ID: Q135788 > > ---------------------------------------------------------------------------- > ---- > > 4.00 WINDOWS > kbprb > > The information in this article applies to: > Microsoft Win32 Application Programming Interface (API) included with: > > - Microsoft Windows 95 version 4.0 > > SYMPTOMS > When you display a context menu for a Notify Icon (see Shell_NotifyIcon), > clicking anywhere besides the menu or the window that created the menu (if > it is visible) doesn't cause the menu to disappear. When this behavior is > corrected, the second time this menu is displayed, it displays and then > immediately disappears. > > RESOLUTION > To correct the first behavior, you need to make the current window the > foreground window before calling TrackPopupMenu or TrackPopupMenuEx. > > The second problem is caused by a problem with TrackPopupMenu. It is > necessary to force a task switch to the application that called > TrackPopupMenu at some time in the near future. This can be accomplished by > posting a benign message to the window or thread. > > The following code will take care of all of this: > > SetForegroundWindow(hDlg); > > // Display the menu > TrackPopupMenu( hSubMenu, > TPM_RIGHTBUTTON, > pt.x, > pt.y, > 0, > hDlg, > NULL); > > PostMessage(hDlg, WM_NULL, 0, 0); > > STATUS > This behavior is by design. > > -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Technical Details
Message-ID:
<715i77$rcr$1@nnrp1.dejanews.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<O61vZXq#9GA.276@uppssnewspub05.moswest.msn.net> <eKgBa1N$9GA.201@uppssnewspub05.moswest.msn.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 104093,ba16b83a68b90a8c,start X-Google-Attributes: gid104093,public X-Google-Thread: 105df1,ba16b83a68b90a8c,start X-Google-Attributes: gid105df1,public X-Google-Thread: fe15c,ba16b83a68b90a8c,start X-Google-Attributes: gidfe15c,public X-Google-Thread: 103bde,49bd03cbbdd13ac6 X-Google-Attributes: gid103bde,public From: breeze@starplace.com Subject: Tray Menu with Visible main window? Date: 1998/10/27 Message-ID: <715i77$rcr$1@nnrp1.dejanews.com> X-Deja-AN: 405696954 References: <O61vZXq#9GA.276@uppssnewspub05.moswest.msn.net> <eKgBa1N$9GA.201@uppssnewspub05.moswest.msn.net> X-Http-Proxy: 1.0 x4.dejanews.com:80 (Squid/1.1.22) for client 130.244.41.57 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Oct 27 22:41:44 1998 GMT Newsgroups: microsoft.public.vb.winapi,microsoft.public.win32.programmer.ole,comp.os.ms-windows.programmer.misc,borland.public.cpp.winapi X-Http-User-Agent: Mozilla/4.05 [en] (WinNT; I)