<?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[Absolute &#x2F; relative Positionen]]></title><description><![CDATA[<p>hallo,<br />
ich möchte ein programm schreiben, dass beim klick auf die rechte maustaste ein kontextmenü öffnet.</p>
<pre><code>void CMessengerDlg::OnRButtonUp(UINT nFlags, CPoint point)
{
	MainMenu.LoadMenu(IDR_MENU1);
	pSubMenu=MainMenu.GetSubMenu(0);
	pSubMenu-&gt;EnableMenuItem(0, MF_ENABLED);
	CRect rect;
	GetClientRect(rect);	
	int x = GetSystemMetrics(SM_CXSCREEN)/2;
	int y = GetSystemMetrics(SM_CYSCREEN)/2;
	pSubMenu-&gt;TrackPopupMenu( TPM_CENTERALIGN |TPM_TOPALIGN | TPM_LEFTBUTTON,
	point.x+(x-(rect.Width()/2)),point.y+(y-(rect.Height()/2)), this, NULL );
	CDialog::OnRButtonUp(nFlags, point);
}
</code></pre>
<p>das funktioniert nur, wenn das fenster zentral positioniert ist. TrackPopupMenu() geht nämlich von absoluten werten für die position aus. ich weiss auch leider nicht, wie ich die absolute fensterposition ermittle oder die relative position bei der funktion angeben kann.<br />
kann mir da jemand helfen ?</p>
<p>danke, TSX</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/161364/absolute-relative-positionen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Jul 2026 06:20:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/161364.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Oct 2006 20:53:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Thu, 05 Oct 2006 20:53:17 GMT]]></title><description><![CDATA[<p>hallo,<br />
ich möchte ein programm schreiben, dass beim klick auf die rechte maustaste ein kontextmenü öffnet.</p>
<pre><code>void CMessengerDlg::OnRButtonUp(UINT nFlags, CPoint point)
{
	MainMenu.LoadMenu(IDR_MENU1);
	pSubMenu=MainMenu.GetSubMenu(0);
	pSubMenu-&gt;EnableMenuItem(0, MF_ENABLED);
	CRect rect;
	GetClientRect(rect);	
	int x = GetSystemMetrics(SM_CXSCREEN)/2;
	int y = GetSystemMetrics(SM_CYSCREEN)/2;
	pSubMenu-&gt;TrackPopupMenu( TPM_CENTERALIGN |TPM_TOPALIGN | TPM_LEFTBUTTON,
	point.x+(x-(rect.Width()/2)),point.y+(y-(rect.Height()/2)), this, NULL );
	CDialog::OnRButtonUp(nFlags, point);
}
</code></pre>
<p>das funktioniert nur, wenn das fenster zentral positioniert ist. TrackPopupMenu() geht nämlich von absoluten werten für die position aus. ich weiss auch leider nicht, wie ich die absolute fensterposition ermittle oder die relative position bei der funktion angeben kann.<br />
kann mir da jemand helfen ?</p>
<p>danke, TSX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150215</guid><dc:creator><![CDATA[TSX]]></dc:creator><pubDate>Thu, 05 Oct 2006 20:53:17 GMT</pubDate></item><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Thu, 05 Oct 2006 21:12:41 GMT]]></title><description><![CDATA[<p><strong>ScreenToClient</strong> und <strong>ClientToScreen</strong> dürften dir helfen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150227</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Thu, 05 Oct 2006 21:12:41 GMT</pubDate></item><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Fri, 06 Oct 2006 06:20:00 GMT]]></title><description><![CDATA[<p>Verstehe ich nicht ganz. Du bekommst doch die Koordinaten direkt geliefert in <strong>point</strong>.</p>
<p>Zumdem sollten Kontextmenus über WM_CONTEXTMENU Handler realisiert werden damit die entsprechende Windows Taste auch berücksichtigt wird und nicht nur der rechte Mausklick!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150295</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 06 Oct 2006 06:20:00 GMT</pubDate></item><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Fri, 06 Oct 2006 07:31:31 GMT]]></title><description><![CDATA[<p>Martin Richter schrieb:</p>
<blockquote>
<p>Verstehe ich nicht ganz. Du bekommst doch die Koordinaten direkt geliefert in <strong>point</strong>.</p>
</blockquote>
<p>Wenn du den normalen rechten Mausklick abfängst, ist der gelieferte Klickpunkt relativ zu deinem Fensterstartpunkt (0|0) zu sehen. Das sind also Fensterkoordinaten.<br />
Für das Kontextmenü braucht man aber die Desktopkoordinaten. Das meint er mit relativ/absolut</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150331</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150331</guid><dc:creator><![CDATA[Pellaeon]]></dc:creator><pubDate>Fri, 06 Oct 2006 07:31:31 GMT</pubDate></item><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Fri, 06 Oct 2006 08:34:05 GMT]]></title><description><![CDATA[<p>Pellaeon schrieb:</p>
<blockquote>
<p>Wenn du den normalen rechten Mausklick abfängst, ist der gelieferte Klickpunkt relativ zu deinem Fensterstartpunkt (0|0) zu sehen. Das sind also Fensterkoordinaten.<br />
Für das Kontextmenü braucht man aber die Desktopkoordinaten. Das meint er mit relativ/absolut</p>
</blockquote>
<p>Stimmt! Das Problem hat man natürlich nicht wenn man WM_CONTEXTMENU verwendet!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150363</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 06 Oct 2006 08:34:05 GMT</pubDate></item><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Sat, 07 Oct 2006 08:02:43 GMT]]></title><description><![CDATA[<p>dankeschön :). ich werde da gleich mal ausprobieren. gestern kam ich leider noch nicht dazu, weil ich mein pc neugemacht hab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1150900</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1150900</guid><dc:creator><![CDATA[TSX]]></dc:creator><pubDate>Sat, 07 Oct 2006 08:02:43 GMT</pubDate></item><item><title><![CDATA[Reply to Absolute &#x2F; relative Positionen on Sat, 07 Oct 2006 17:10:59 GMT]]></title><description><![CDATA[<p>mit WM_CONTEXTMENU funktioniert das wie gewünscht. vielen dank <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="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1151125</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1151125</guid><dc:creator><![CDATA[TSX]]></dc:creator><pubDate>Sat, 07 Oct 2006 17:10:59 GMT</pubDate></item></channel></rss>