<?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-Menüs erstellen]]></title><description><![CDATA[<p>Kann mir jemand erklären, wie ich dies Popup Menüs erstellen kann. Die überall erscheinen, wenn man die rechte maustaste drückt.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/43188/popup-menüs-erstellen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 31 May 2026 11:36:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/43188.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Jul 2003 15:52:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 15:52:41 GMT]]></title><description><![CDATA[<p>Kann mir jemand erklären, wie ich dies Popup Menüs erstellen kann. Die überall erscheinen, wenn man die rechte maustaste drückt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/312873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/312873</guid><dc:creator><![CDATA[TheDeath]]></dc:creator><pubDate>Sat, 19 Jul 2003 15:52:41 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 15:59:12 GMT]]></title><description><![CDATA[<p>So z.B.</p>
<pre><code>UINT nFlags = MF_BYPOSITION;

CMenu* PopupMenu = new CMenu();
PopupMenu-&gt;CreatePopupMenu();

PopupMenu-&gt;InsertMenu(-1, MF_BYPOSITION, IDM_MENU1, &quot;Menüpunkt 1&quot;);
PopupMenu-&gt;InsertMenu(-1, MF_BYPOSITION, IDM_MENU2, &quot;Menüpunkt 2&quot;);
PopupMenu-&gt;InsertMenu(-1, MF_BYPOSITION, IDM_MENU3, &quot;Menüpunkt 3&quot;);
PopupMenu-&gt;InsertMenu(-1, MF_BYPOSITION, IDM_MENU4, &quot;Menüpunkt 4&quot;);

CPoint pPoint;
GetCursorPos(&amp;pPoint);

PopupMenu-&gt;TrackPopupMenu(TPM_LEFTALIGN + TPM_LEFTBUTTON,pPoint.x, pPoint.y, this, NULL);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/312878</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/312878</guid><dc:creator><![CDATA[GeorgeHomes]]></dc:creator><pubDate>Sat, 19 Jul 2003 15:59:12 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 16:44:52 GMT]]></title><description><![CDATA[<p>Gut, danke das geht.<br />
Aber wie kann ich da jetzt machen, das z.b. wenn man auf &quot;Menüpunkt 1&quot; klickt eine MessageBox erscheint.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/312896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/312896</guid><dc:creator><![CDATA[TheDeath]]></dc:creator><pubDate>Sat, 19 Jul 2003 16:44:52 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 16:57:56 GMT]]></title><description><![CDATA[<p>GeorgeHomes hat die Menüeinträge zur Laufzeit eingefügt. Ich würde das mit Resourcen mach, so wie <a href="http://www.mut.de/media_remote/buecher/VCPLUS6/data/kap06.htm" rel="nofollow">hier</a>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/312900</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/312900</guid><dc:creator><![CDATA[newvet]]></dc:creator><pubDate>Sat, 19 Jul 2003 16:57:56 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 17:08:54 GMT]]></title><description><![CDATA[<p>Das hab ich schon ausprobiert, damit komm ich nicht so ganz klar (Programm stürzt ab).<br />
Die Idee von GeorgeHomes funktioniert doch ganz gut.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/312912</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/312912</guid><dc:creator><![CDATA[TheDeath]]></dc:creator><pubDate>Sat, 19 Jul 2003 17:08:54 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 20:56:08 GMT]]></title><description><![CDATA[<p>So finde ich es am bequemsten:</p>
<pre><code class="language-cpp">void CTestDlg::OnOK() 
{
	CMenu menu;
	menu.CreatePopupMenu();

	menu.AppendMenu(MF_STRING,1,&quot;Eintrag 1&quot;);
	menu.AppendMenu(MF_STRING,2,&quot;Eintrag 2&quot;);
	menu.AppendMenu(MF_STRING,3,&quot;Eintrag 3&quot;);
	menu.AppendMenu(MF_STRING,4,&quot;Eintrag 4&quot;);

	CPoint pt;
	GetCursorPos(&amp;pt);
	int ret = menu.TrackPopupMenu(TPM_NONOTIFY | TPM_RETURNCMD,pt.x,pt.y,this);
	switch(ret)
	{
	case 1:
		// ...
		// break;
	case 2:
		// ...
		// break;
	case 3:
		// ...
		// break;
	case 4:
		{
			CString text;
			text.Format(&quot;Auswahl ID: %d&quot;,ret);
			MessageBox(text);
		}
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/313035</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313035</guid><dc:creator><![CDATA[Oliver]]></dc:creator><pubDate>Sat, 19 Jul 2003 20:56:08 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 21:27:56 GMT]]></title><description><![CDATA[<p>Ich definiere die Menüpunkte lieber zur Laufzeit, weil man dann einfach allgmein gleich flexibeler ist. In vielen fällen ist ein variables Contextmenü recht praktisch.</p>
<p>Die TrackPopupMenu Funktion TPM_RETURNCMD auf wartemodus zu schalten und dann direkt auf den Rückgabewert zu reagieren, ist auch sicher keine schlechte Variante. Ich persönlich finde aber das verarbeiten via Messages allgemeiner, da man dann auch problemloser einen Punkt aus dem Contextmenü auch ins normale Menü einfügen kann.</p>
<p>Alternativ kannst du die Messages auch in einer selbst überschriebenen WindowProc verarbeiten, in der du auf die WM_COMMAND Message reagierst. Dann steht im LOWORD des wParams die ID des ausgelösten Menüpunktes. So eine überschriebene WindowProc könnte dann so aussehen:</p>
<pre><code class="language-cpp">LRESULT CTestContext2Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	// TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen
	switch (message)
	{
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDM_MENU1:
			// Hier benutzerdefinierte Funktion.
			MessageBox(&quot;Menüpunkte 1 angeklickt!&quot;);
			return true;
		}
		break;
	}

	return CDialog::WindowProc(message, wParam, lParam);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/313048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313048</guid><dc:creator><![CDATA[GeorgeHomes]]></dc:creator><pubDate>Sat, 19 Jul 2003 21:27:56 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sat, 19 Jul 2003 22:44:50 GMT]]></title><description><![CDATA[<p>Wo wir gerade so schön dabei sind: Wenn ich einen Menüpunkt zur Laufzeit hinzufüge wird er doch bei SDI und MDI Anwendungen (und bei Meiner Dialogfeld Anwendung wo ich nicht CMenu verwende) deaktiviert dargestellt. EnableMenuItem hilft da nicht. Wie bekomme ich das hin das man das Item anklicken kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/313065</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313065</guid><dc:creator><![CDATA[newvet]]></dc:creator><pubDate>Sat, 19 Jul 2003 22:44:50 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sun, 20 Jul 2003 07:56:54 GMT]]></title><description><![CDATA[<p>Hm, das von dir beschriebene Problem ist mir noch nie aufgefallen. Also ich habe jetzt einfach mal (in einer Dialogfeld Anwendung) meinen IDM_MENU1 punkt in das Dialogfeldmenü (mit Resourceneditor) hinzugefügt. Der ist nicht deaktiviert.</p>
<p>Dann habe ichs mal damit versucht, in das Dialogfeldmenü ein Item zur Laufzeit hinzuzufügen und auch das ist nicht deaktiviert:</p>
<pre><code class="language-cpp">CMenu* pMenu = GetMenu();
pMenu = pMenu-&gt;GetSubMenu(0);
pMenu-&gt;InsertMenu(-1, MF_BYCOMMAND, 103, &quot;Menüpunkt 2&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/313101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313101</guid><dc:creator><![CDATA[GeorgeHomes]]></dc:creator><pubDate>Sun, 20 Jul 2003 07:56:54 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sun, 20 Jul 2003 12:49:42 GMT]]></title><description><![CDATA[<p>Die Idee von Nemesyzz funktioniert gut, wie kann ich es aber machen, das das popup menü nur innerhalb eines Listenelementes erscheint?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/313267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313267</guid><dc:creator><![CDATA[TheDeath]]></dc:creator><pubDate>Sun, 20 Jul 2003 12:49:42 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sun, 20 Jul 2003 14:21:08 GMT]]></title><description><![CDATA[<p>OnContextMenu() übeschreiben, CWnd vergleichen</p>
<pre><code class="language-cpp">if (pWnd == GetDlgItem(IDC_LIST1))
	GetMenu()-&gt;GetSubMenu(0)-&gt;TrackPopupMenu(/*...*/);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/313328</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313328</guid><dc:creator><![CDATA[Shlo]]></dc:creator><pubDate>Sun, 20 Jul 2003 14:21:08 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Sun, 20 Jul 2003 14:42:39 GMT]]></title><description><![CDATA[<p>Jo, super. Klappt<br />
Danke</p>
<p>PS. Find ich gut, das es hier im Forum noch hilfsbereite leute gibt und nicht nur solche, die gleich auf irgendwelche anderen seite verweisen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/313343</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/313343</guid><dc:creator><![CDATA[TheDeath]]></dc:creator><pubDate>Sun, 20 Jul 2003 14:42:39 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 22 Jul 2003 06:43:20 GMT]]></title><description><![CDATA[<p>hast du VC++?<br />
denn da kenn ich einen Trick :-.)<br />
einen einfachen ohne viel tippen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/314426</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/314426</guid><dc:creator><![CDATA[maximo]]></dc:creator><pubDate>Tue, 22 Jul 2003 06:43:20 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 22 Jul 2003 09:14:36 GMT]]></title><description><![CDATA[<p>Ja, hab ich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/314522</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/314522</guid><dc:creator><![CDATA[TheDeath]]></dc:creator><pubDate>Tue, 22 Jul 2003 09:14:36 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 22 Jul 2003 09:37:31 GMT]]></title><description><![CDATA[<p>und was ich eben kann ist für dialogfelder<br />
kannst damit was anfangen?<br />
dann werde ich das doc für dich heraussuchen<br />
wenn es für dialoge sein soll</p>
]]></description><link>https://www.c-plusplus.net/forum/post/314540</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/314540</guid><dc:creator><![CDATA[maximo]]></dc:creator><pubDate>Tue, 22 Jul 2003 09:37:31 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 22 Jul 2003 14:15:34 GMT]]></title><description><![CDATA[<p>Ich benutze Eure Anleitung für das Tray-Icon und es klappt ja soweit alles sehr gut.<br />
Wie bekomme ich es aber hin, dass sich das Popup-Menu wieder schließt, wenn ich irgendwo anders hinklicke und nicht ins Menu?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/314835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/314835</guid><dc:creator><![CDATA[MuehBln]]></dc:creator><pubDate>Tue, 22 Jul 2003 14:15:34 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Wed, 23 Jul 2003 06:36:44 GMT]]></title><description><![CDATA[<p>Habs selbst gefunden... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Und für alle die es auch interessiert:</p>
<blockquote>
<p><em><strong>Auszug aus der MSDN</strong></em><br />
<strong>Remarks</strong><br />
To display a context menu for a notification icon, the current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx. Otherwise, the menu will not disappear when the user clicks outside of the menu or the window that created the menu (if it is visible). However, when the current window is the foreground window, the second time this menu is displayed, it displays and then immediately disappears. To correct this, you must force a task switch to the application that called TrackPopupMenu at some time in the near future. This is done by posting a benign message to the window or thread, as shown in the following code sample:</p>
</blockquote>
<p>Also das heißt, Window erst als Foreground setzen und dann gleich WM_NULL posten:</p>
<pre><code class="language-cpp">SetForegroundWindow();
TrackPopupMenu(.......);
PostMessage(WM_NULL, 0, 0);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/315292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/315292</guid><dc:creator><![CDATA[MuehBln]]></dc:creator><pubDate>Wed, 23 Jul 2003 06:36:44 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 07 Oct 2003 05:48:28 GMT]]></title><description><![CDATA[<p>Die folgende Variante von Nemesyzz gefällt mir sehr gut. Ich brauche allerdings noch eine Titelzeile in der ich einen String ausgeben kann. Irgendwie finde ich nicht die richtigen Parameter dafür.</p>
<p>Welche Möglichkeiten gibt es?</p>
<p>Nemesyzz schrieb:</p>
<blockquote>
<p>So finde ich es am bequemsten:</p>
<pre><code class="language-cpp">void CTestDlg::OnOK() 
{
	CMenu menu;
	menu.CreatePopupMenu();

	menu.AppendMenu(MF_STRING,1,&quot;Eintrag 1&quot;);
	menu.AppendMenu(MF_STRING,2,&quot;Eintrag 2&quot;);
	menu.AppendMenu(MF_STRING,3,&quot;Eintrag 3&quot;);
	menu.AppendMenu(MF_STRING,4,&quot;Eintrag 4&quot;);

	CPoint pt;
	GetCursorPos(&amp;pt);
	int ret = menu.TrackPopupMenu(TPM_NONOTIFY | TPM_RETURNCMD,pt.x,pt.y,this);
	switch(ret)
	{
	case 1:
		// ...
		// break;
	case 2:
		// ...
		// break;
	case 3:
		// ...
		// break;
	case 4:
		{
			CString text;
			text.Format(&quot;Auswahl ID: %d&quot;,ret);
			MessageBox(text);
		}
	}
}
</code></pre>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/367231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/367231</guid><dc:creator><![CDATA[Tino_]]></dc:creator><pubDate>Tue, 07 Oct 2003 05:48:28 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 07 Oct 2003 09:10:37 GMT]]></title><description><![CDATA[<p>Gibt es bei PopUp Menüs tatsächlich keine Überschriften? Und wie kann man dynamisch die Schriftarte u.s.w. der einzelnen Menüeinträge bestimmen?</p>
<p>Genügt es den Font zu setzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/367360</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/367360</guid><dc:creator><![CDATA[Tino_]]></dc:creator><pubDate>Tue, 07 Oct 2003 09:10:37 GMT</pubDate></item><item><title><![CDATA[Reply to Popup-Menüs erstellen on Tue, 07 Oct 2003 12:57:51 GMT]]></title><description><![CDATA[<p><a href="http://www.codeproject.com/menu/gradientmenus.asp" rel="nofollow">http://www.codeproject.com/menu/gradientmenus.asp</a><br />
Diese Klasse verwende ich bei meinen Popup-Menu um einen Titel anzuzeigen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/367558</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/367558</guid><dc:creator><![CDATA[Andorxor]]></dc:creator><pubDate>Tue, 07 Oct 2003 12:57:51 GMT</pubDate></item></channel></rss>