<?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[Problem mit icon im systray]]></title><description><![CDATA[<p>hi,</p>
<p>ich habe folgendes Problem:<br />
mein Programm erstellt ein icon im systray. funktioniert alles wunderbar.<br />
sobald ich aber die windows procedure um folgenden code erweiter:</p>
<pre><code class="language-cpp">case WM_DRAWITEM:
            {
                LPDRAWITEMSTRUCT lpdiControl = (LPDRAWITEMSTRUCT)lParam;
                if(lpdiControl-&gt;CtlType == ODT_BUTTON){
                    HRGN hrgnButton1 = CreateRectRgn(0, 0, 0, 0);
                    GetWindowRgn(lpdiControl-&gt;hwndItem, hrgnButton1);
                    RECT rcClient; GetClientRect(lpdiControl-&gt;hwndItem, &amp;rcClient);

                    FillRect(lpdiControl-&gt;hDC, &amp;lpdiControl-&gt;rcItem, GetSysColorBrush(COLOR_WINDOW));
                    if(lpdiControl-&gt;itemState &amp; ODS_SELECTED){
                        rcClient.top += 1, rcClient.left += 1;
                        HRGN hrgnButton2 = CreateEllipticRgnIndirect(&amp;rcClient);
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton1, GetSysColorBrush(COLOR_BTNSHADOW));
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton2, GetSysColorBrush(COLOR_BTNFACE));
                        DeleteObject(hrgnButton2);
                    }else{
                        rcClient.bottom -= 1, rcClient.right -= 1;
                        HRGN hrgnButton2 = CreateEllipticRgnIndirect(&amp;rcClient);
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton1, GetSysColorBrush(COLOR_BTNSHADOW));
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton2, GetSysColorBrush(COLOR_BTNFACE));
                        DeleteObject(hrgnButton2);
                    }

                    int nLen = (GetWindowTextLength(lpdiControl-&gt;hwndItem) + 1);
                    char *szText = (char *)malloc(nLen);
                    GetWindowText(lpdiControl-&gt;hwndItem, szText, nLen);
                    SelectClipRgn(lpdiControl-&gt;hDC, hrgnButton1);
                    DrawText(lpdiControl-&gt;hDC, szText, --nLen, &amp;rcClient, (DT_SINGLELINE | DT_CENTER | DT_VCENTER));
                    SelectClipRgn(lpdiControl-&gt;hDC, NULL);
                    DeleteObject(hrgnButton1);
                    free(szText);
                }
            }
</code></pre>
<p>meldet mir windows beim ausführen ein fehler und bricht das programm ab, sobald ich mit der maus über das icon fahre. woran liegt das???</p>
<p>mfg ghill</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/201305/problem-mit-icon-im-systray</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 06:55:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/201305.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Dec 2007 19:30:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit icon im systray on Thu, 27 Dec 2007 19:30:03 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>ich habe folgendes Problem:<br />
mein Programm erstellt ein icon im systray. funktioniert alles wunderbar.<br />
sobald ich aber die windows procedure um folgenden code erweiter:</p>
<pre><code class="language-cpp">case WM_DRAWITEM:
            {
                LPDRAWITEMSTRUCT lpdiControl = (LPDRAWITEMSTRUCT)lParam;
                if(lpdiControl-&gt;CtlType == ODT_BUTTON){
                    HRGN hrgnButton1 = CreateRectRgn(0, 0, 0, 0);
                    GetWindowRgn(lpdiControl-&gt;hwndItem, hrgnButton1);
                    RECT rcClient; GetClientRect(lpdiControl-&gt;hwndItem, &amp;rcClient);

                    FillRect(lpdiControl-&gt;hDC, &amp;lpdiControl-&gt;rcItem, GetSysColorBrush(COLOR_WINDOW));
                    if(lpdiControl-&gt;itemState &amp; ODS_SELECTED){
                        rcClient.top += 1, rcClient.left += 1;
                        HRGN hrgnButton2 = CreateEllipticRgnIndirect(&amp;rcClient);
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton1, GetSysColorBrush(COLOR_BTNSHADOW));
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton2, GetSysColorBrush(COLOR_BTNFACE));
                        DeleteObject(hrgnButton2);
                    }else{
                        rcClient.bottom -= 1, rcClient.right -= 1;
                        HRGN hrgnButton2 = CreateEllipticRgnIndirect(&amp;rcClient);
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton1, GetSysColorBrush(COLOR_BTNSHADOW));
                        FillRgn(lpdiControl-&gt;hDC, hrgnButton2, GetSysColorBrush(COLOR_BTNFACE));
                        DeleteObject(hrgnButton2);
                    }

                    int nLen = (GetWindowTextLength(lpdiControl-&gt;hwndItem) + 1);
                    char *szText = (char *)malloc(nLen);
                    GetWindowText(lpdiControl-&gt;hwndItem, szText, nLen);
                    SelectClipRgn(lpdiControl-&gt;hDC, hrgnButton1);
                    DrawText(lpdiControl-&gt;hDC, szText, --nLen, &amp;rcClient, (DT_SINGLELINE | DT_CENTER | DT_VCENTER));
                    SelectClipRgn(lpdiControl-&gt;hDC, NULL);
                    DeleteObject(hrgnButton1);
                    free(szText);
                }
            }
</code></pre>
<p>meldet mir windows beim ausführen ein fehler und bricht das programm ab, sobald ich mit der maus über das icon fahre. woran liegt das???</p>
<p>mfg ghill</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1426981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1426981</guid><dc:creator><![CDATA[Ghill]]></dc:creator><pubDate>Thu, 27 Dec 2007 19:30:03 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit icon im systray on Fri, 28 Dec 2007 10:34:54 GMT]]></title><description><![CDATA[<p>Du hast doch einen Debugger. An welcher Stelle kanllt es denn. Bist Du sicher, dass es in dieser Routine ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1427154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1427154</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 28 Dec 2007 10:34:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit icon im systray on Fri, 28 Dec 2007 16:27:11 GMT]]></title><description><![CDATA[<p>nach dem case-Label 'break' bzw. 'return' nicht vergessen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1427291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1427291</guid><dc:creator><![CDATA[hey]]></dc:creator><pubDate>Fri, 28 Dec 2007 16:27:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit icon im systray on Fri, 28 Dec 2007 20:01:47 GMT]]></title><description><![CDATA[<p>oh mann!<br />
ich sollt mich glaub besser konzentrieren....^^<br />
vielen dank, jetzt geht alles<br />
mfg ghill</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1427389</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1427389</guid><dc:creator><![CDATA[Ghill]]></dc:creator><pubDate>Fri, 28 Dec 2007 20:01:47 GMT</pubDate></item></channel></rss>