<?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[Trayicon verschwindet sobald mit maus darüber]]></title><description><![CDATA[<p>Was passiert siehe Threadtitel. Liegt das eventuell daran dass ich für hwnd 0 angebe? Ich habe kein Fenster in meiner Anwendung, soll nur über das Icon gesteuert werden.</p>
<p>Hab den Code aus den FAQ.</p>
<pre><code class="language-cpp">nidTrayIcon.cbSize = sizeof(nidTrayIcon);
    nidTrayIcon.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_TRAYICON));;
    nidTrayIcon.hWnd = 0;
    nidTrayIcon.uCallbackMessage = WM_USER;
    nidTrayIcon.uFlags = NIF_ICON; // zum Test nur Icon!
    nidTrayIcon.uID = 0x0200;

    if(!Shell_NotifyIcon(NIM_ADD, &amp;nidTrayIcon))
        MessageBox(0, 
            L&quot;BOOOM! &quot;,
            L&quot;Error&quot;, MB_ICONEXCLAMATION | MB_OK);
</code></pre>
<p>Wie gesagt zuerst ist das Icon da, nur sobald man mit dem Mauszeiger darüber fährt geht nix mehr.</p>
<p>Wie geht das <strong>ohne</strong> Window?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/145404/trayicon-verschwindet-sobald-mit-maus-darüber</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 05:25:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/145404.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Apr 2006 15:29:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trayicon verschwindet sobald mit maus darüber on Thu, 27 Apr 2006 15:29:35 GMT]]></title><description><![CDATA[<p>Was passiert siehe Threadtitel. Liegt das eventuell daran dass ich für hwnd 0 angebe? Ich habe kein Fenster in meiner Anwendung, soll nur über das Icon gesteuert werden.</p>
<p>Hab den Code aus den FAQ.</p>
<pre><code class="language-cpp">nidTrayIcon.cbSize = sizeof(nidTrayIcon);
    nidTrayIcon.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_TRAYICON));;
    nidTrayIcon.hWnd = 0;
    nidTrayIcon.uCallbackMessage = WM_USER;
    nidTrayIcon.uFlags = NIF_ICON; // zum Test nur Icon!
    nidTrayIcon.uID = 0x0200;

    if(!Shell_NotifyIcon(NIM_ADD, &amp;nidTrayIcon))
        MessageBox(0, 
            L&quot;BOOOM! &quot;,
            L&quot;Error&quot;, MB_ICONEXCLAMATION | MB_OK);
</code></pre>
<p>Wie gesagt zuerst ist das Icon da, nur sobald man mit dem Mauszeiger darüber fährt geht nix mehr.</p>
<p>Wie geht das <strong>ohne</strong> Window?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046491</guid><dc:creator><![CDATA[Fragensteller123]]></dc:creator><pubDate>Thu, 27 Apr 2006 15:29:35 GMT</pubDate></item><item><title><![CDATA[Reply to Trayicon verschwindet sobald mit maus darüber on Thu, 27 Apr 2006 15:49:30 GMT]]></title><description><![CDATA[<p>Du musst ein Fenster angeben!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046517</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046517</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 27 Apr 2006 15:49:30 GMT</pubDate></item><item><title><![CDATA[Reply to Trayicon verschwindet sobald mit maus darüber on Thu, 27 Apr 2006 17:53:22 GMT]]></title><description><![CDATA[<p>MSDN schrieb:</p>
<blockquote>
<p>Adding and Deleting Taskbar Icons in the Status Area<br />
You add an icon to the taskbar status area by filling in a NOTIFYICONDATA structure and<br />
then passing the structure to Shell_NotifyIcon with dwMessage set to NIM_ADD. The<br />
structure members must specify the handle to the window that is adding the icon, as<br />
well as the icon identifier and icon handle. You can also specify ToolTip text for the<br />
icon. If you need to receive mouse messages for the icon, specify the identifier of the<br />
callback message that the system should use to send the message to the window procedure.</p>
<p>The function in the following example demonstrates how to add an icon to the taskbar.</p>
<pre><code class="language-cpp">// MyTaskBarAddIcon - adds an icon to the taskbar status area. 
// Returns TRUE if successful, or FALSE otherwise. 
// hwnd - handle to the window to receive callback messages. 
// uID - identifier of the icon. 
// hicon - handle to the icon to add. 
// lpszTip - ToolTip text. 
BOOL MyTaskBarAddIcon(HWND hwnd, UINT uID, HICON hicon, LPSTR lpszTip) 
{ 
    BOOL res; 
    NOTIFYICONDATA tnid; 
 
    tnid.cbSize = sizeof(NOTIFYICONDATA); 
    tnid.hWnd = hwnd; 
    tnid.uID = uID; 
    tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; 
    tnid.uCallbackMessage = MYWM_NOTIFYICON; 
    tnid.hIcon = hicon; 
    if (lpszTip) 
        lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip)); 
    else 
        tnid.szTip[0] = '\0'; 
 
    res = Shell_NotifyIcon(NIM_ADD, &amp;tnid); 
 
    if (hicon) 
        DestroyIcon(hicon); 
 
    return res; 
}
</code></pre>
<p>To delete an icon from the taskbar status area, fill a NOTIFYICONDATA structure and call Shell_NotifyIcon with dwMessage set to NIM_DELETE. When deleting a taskbar icon, specify only the cbSize, hWnd, and uID members of the structure. For example</p>
<pre><code class="language-cpp">// MyTaskBarDeleteIcon - deletes an icon from the taskbar status area. 
// Returns TRUE if successful, or FALSE otherwise. 
// hwnd - handle to the window that added the icon. 
// uID - identifier of the icon to delete. 
BOOL MyTaskBarDeleteIcon(HWND hwnd, UINT uID) 
{ 
    BOOL res; 
    NOTIFYICONDATA tnid; 
 
    tnid.cbSize = sizeof(NOTIFYICONDATA); 
    tnid.hWnd = hwnd; 
    tnid.uID = uID; 
         
    res = Shell_NotifyIcon(NIM_DELETE, &amp;tnid); 
    return res; 
}
</code></pre>
<p>Receiving Mouse Events<br />
If you specify a callback message for a taskbar icon, the system sends the message to your application whenever a mouse event occurs in the icon's bounding rectangle. The wParam parameter of the message specifies the identifier of the taskbar icon, and the lParam parameter of the message specifies the message that the system generated as a result of the mouse event.</p>
<p>The function in the following example is from an application that adds both battery and printer icons to the taskbar. The application calls the function when it receives a callback message. The function determines whether the user has clicked one of the icons and, if a click has occurred, calls an application-defined function to display status information.</p>
<pre><code class="language-cpp">// On_MYWM_NOTIFYICON - processes callback messages for taskbar icons. 
// wParam - first message parameter of the callback message. 
// lParam - second message parameter of the callback message. 
void On_MYWM_NOTIFYICON(WPARAM wParam, LPARAM lParam) 
{ 
    UINT uID; 
    UINT uMouseMsg; 
 
    uID = (UINT) wParam; 
    uMouseMsg = (UINT) lParam; 
 
    if (uMouseMsg == WM_LBUTTONDOWN) { 
        switch (uID) { 
            case IDI_MYBATTERYICON: 
 
                // The user clicked the battery icon. Display the 
                // battery status. 
                ShowBatteryStatus(); 
                break; 
 
            case IDI_MYPRINTERICON: 
 
                // The user clicked the printer icon. Display the 
                // status of the print job. 
                ShowJobStatus(); 
                break; 
 
            default: 
                break; 
        } 
     } 
     return; 
 }
</code></pre>
</blockquote>
<p>HIH<br />
Greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046629</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046629</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 27 Apr 2006 17:53:22 GMT</pubDate></item><item><title><![CDATA[Reply to Trayicon verschwindet sobald mit maus darüber on Thu, 27 Apr 2006 18:30:54 GMT]]></title><description><![CDATA[<p>OT: Hätte es nicht auch einen Link getan!? Es macht nicht gerade viel Sinn die MSDN seitenweise zu zitieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046657</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 27 Apr 2006 18:30:54 GMT</pubDate></item><item><title><![CDATA[Reply to Trayicon verschwindet sobald mit maus darüber on Thu, 27 Apr 2006 23:21:30 GMT]]></title><description><![CDATA[<p>Lieber Jochen!<br />
Ich benutze die Online-MSDN sehr selten und es hätte wahrscheinlich Tage<br />
gedauert bis ich diesen Artikel gefunden hätte. Lokal wusst ich sofort, wo<br />
er ist. Ich verstehe natürlich deine Einwand, bin aber beim Posten davon<br />
ausgegangen, daß dieß (außer einem netten &quot;Danke&quot; <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="😉"
    /> der letzte Post dieses<br />
Threads sein würde (womit dann auch die Übersichtlichkeit allzusehr gelitten<br />
hätte. Ich werde mich trotzdem in Zukunft etwas mit längeren Zitaten zurück-<br />
halten und lieber Links spenden.</p>
<p>beste Grüße<br />
Erich Reiter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046805</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046805</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 27 Apr 2006 23:21:30 GMT</pubDate></item><item><title><![CDATA[Reply to Trayicon verschwindet sobald mit maus darüber on Fri, 28 Apr 2006 06:11:09 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>Ich benutze die Online-MSDN sehr selten und es hätte wahrscheinlich Tage gedauert bis ich diesen Artikel gefunden hätte.</p>
</blockquote>
<p>Einfach den ersten Satz in Google eingegegen führt sofort zu:<br />
<a href="http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp" rel="nofollow">http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp</a></p>
<p>Dann hätte man halt auch die restlichen Infos aus diesem Artikel gehabt... aber ist nicht so tragisch...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1046836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1046836</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Fri, 28 Apr 2006 06:11:09 GMT</pubDate></item></channel></rss>