<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Popup-menu soll beim klick ins leere verschwinden!]]></title><description><![CDATA[<p>Ich habe ein Tray-Icon, und wenn man darauf rechtsklick macht erscheint ein Popup-menu, welches auch wunderbar auf Eingaben reagiert!<br />
Das Problem ist, wenn ich auf mein Tray-Icon klicke (zB.:ausversehen) und dann ins Leere klicke, bleibt das Popup-Menu erhalten. Ich will aber, dass es verschwindet, es bleibt aber so lange erhalten, bis ich einen Eintrag im Menü angeklickt habe.<br />
Wie kann ich machen, dass es verschwindet, wenn ich zB.: auf den Desktop klicke?<br />
Ich erstelle es etwa so:</p>
<pre><code class="language-cpp">GetCursorPos(&amp;point);
TrackPopupMenuEx(menu,TPM_RIGHTBUTTON|TPM_RIGHTALIGN,point.x,point.y,hWnd,NULL);
</code></pre>
<p>Danke schonmal,</p>
<p>Gruß Streusselkuchen</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/108146/popup-menu-soll-beim-klick-ins-leere-verschwinden</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 05:35:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/108146.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 26 Apr 2005 17:12:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Popup-menu soll beim klick ins leere verschwinden! on Tue, 26 Apr 2005 17:12:58 GMT]]></title><description><![CDATA[<p>Ich habe ein Tray-Icon, und wenn man darauf rechtsklick macht erscheint ein Popup-menu, welches auch wunderbar auf Eingaben reagiert!<br />
Das Problem ist, wenn ich auf mein Tray-Icon klicke (zB.:ausversehen) und dann ins Leere klicke, bleibt das Popup-Menu erhalten. Ich will aber, dass es verschwindet, es bleibt aber so lange erhalten, bis ich einen Eintrag im Menü angeklickt habe.<br />
Wie kann ich machen, dass es verschwindet, wenn ich zB.: auf den Desktop klicke?<br />
Ich erstelle es etwa so:</p>
<pre><code class="language-cpp">GetCursorPos(&amp;point);
TrackPopupMenuEx(menu,TPM_RIGHTBUTTON|TPM_RIGHTALIGN,point.x,point.y,hWnd,NULL);
</code></pre>
<p>Danke schonmal,</p>
<p>Gruß Streusselkuchen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/776084</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/776084</guid><dc:creator><![CDATA[Streusselkuchen]]></dc:creator><pubDate>Tue, 26 Apr 2005 17:12:58 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-menu soll beim klick ins leere verschwinden! on Tue, 26 Apr 2005 17:25:06 GMT]]></title><description><![CDATA[<blockquote>
<p>NOTE on TrackPopupMenu</p>
<p>Many people have had troubles using TrackPopupMenu. They have reported that the popup menu will often not disappear once the mouse is clicked outside of the menu, even though they have set the last parameter of TrackPopupMenu() as NULL. This is a Microsoft &quot;feature&quot;, and is by design. The mind boggles, doesn't it?</p>
<p>Anyway - to workaround this &quot;feature&quot;, one must set the current window as the foreground window before calling TrackPopupMenu. This then causes a second problem - namely that the next time the menu is displayed it displays then immediately disappears. To fix this problem, you must make the currernt application active after the menu disappears. This can be done by sending a benign message such as WM_NULL to the current window.</p>
<p>So - what should have been a simple:</p>
<p>Code:</p>
<p>TrackPopupMenu(hSubMenu, TPM_RIGHTBUTTON, pt.x,pt.y, 0, hDlg, NULL);</p>
<p>becomes</p>
<p>Code:</p>
<p>SetForegroundWindow(hDlg);<br />
TrackPopupMenu(hSubMenu, TPM_RIGHTBUTTON, pt.x,pt.y, 0, hDlg, NULL);<br />
PostMessage(hDlg, WM_NULL, 0, 0);</p>
<p>Refer to KB article &quot;PRB: Menus for Notification Icons Don't Work Correctly&quot; for more info.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/776089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/776089</guid><dc:creator><![CDATA[guenni81]]></dc:creator><pubDate>Tue, 26 Apr 2005 17:25:06 GMT</pubDate></item></channel></rss>