<?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[Icon nicht neben Fenstertitel trotz resource!!!]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>habe kuerzlich gesehen das hier nach dem Icon in der linken oberen Ecke<br />
eines Fensters gefragt wurde. Leider sind die Treads nicht weiter behandelt worden.<br />
Habe mich daran gemacht bei meinem Programm auch mal ein Icon anzeigen zu lassen,<br />
und nicht immer dieses weisse Viereck.</p>
<p>Nun ist der Code zwar aus einem Tuturial uebernommen in dem auch mit Dev-C++ gearbeitet<br />
wurde, nur leider funzt es nicht so wie es soll. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Hier mal ein wenig Code</p>
<pre><code class="language-cpp">//main.c

#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;time.h&gt;
#include &lt;stdbool.h&gt;
#include &quot;resource.h&quot;

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

char szClassName[ ] = &quot;WindowsApp&quot;;

int WINAPI
WinMain (HINSTANCE hThisInstance,
         HINSTANCE hPrevInstance,
         LPSTR lpszArgument,
         int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;   /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);
    wincl.hIcon = LoadIcon (GetModuleHandle(NULL), MAKEINTRESOURCE(ID_ICON));
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use actual Windows's color as the background of the window */
    wincl.hbrBackground = (HBRUSH) GetSysColorBrush(COLOR_WINDOW); //rueckgabewert von GetSysColorBrush wird gecastet

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&amp;wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;Nicos Alter 5&quot;,       /* Title Text */
           WS_BORDER | WS_SYSMENU, /* thin border, size can't be change with close button */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           200,                 /* The programs width */
           120,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;

}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK
WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

HDC hdc;		/* A device context used for drawing */
PAINTSTRUCT ps;	/* Also used during window drawing */
RECT rc;		/* A rectangle used during drawing */

const UINT TimerID = 1;    
const int iDelay = 1000;        //    = Zeit einstellen

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
            {
            	SetTimer(hwnd, TimerID, iDelay, NULL); //Timer setzen
            	return 0;

            }

        case WM_TIMER:
           { 
                berechne_alter();    
                InvalidateRect(hwnd, NULL, TRUE); 
            	return 0;
            	break;

           }    
        case WM_DESTROY:
            {
            	KillTimer(hwnd, TimerID);	//nicht vergessen den Timer zu loeschen!!!
             	PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            	break;
            }

        case WM_PAINT:
            {
            	/* The window needs to be painted (redrawn). */
            	hdc = BeginPaint (hwnd, &amp;ps);
            	GetClientRect (hwnd, &amp;rc);

                //Hintergrund der Schriftart transparent machen
                SetBkMode(hdc,TRANSPARENT);	

                //den Text ausgeben
                DrawText (hdc, (LPCTSTR)&amp;cText, -1, &amp;rc, 
               	DT_SINGLELINE | DT_CENTER | DT_VCENTER );

               	EndPaint (hwnd, &amp;ps);
                return 0;
                break;
        }    
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
</code></pre>
<p>die resource.h</p>
<pre><code class="language-cpp">#define ID_ICON		111
</code></pre>
<p>und zu guter letzt noch resource.rc</p>
<pre><code class="language-cpp">ID_ICON		ICON		&quot;NicosAlter.ico&quot;
</code></pre>
<p>Die Icondatei liegt im selben Verzeichniss wie alle anderen Dateien.<br />
(*.c; *.h; *.rc usw.)</p>
<p>Hat jemand eine Idee warum das Icon nur in der Taskleiste angezeigt wird? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/89226/icon-nicht-neben-fenstertitel-trotz-resource</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 17:01:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/89226.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 17 Oct 2004 18:49:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Icon nicht neben Fenstertitel trotz resource!!! on Sun, 17 Oct 2004 18:49:35 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>habe kuerzlich gesehen das hier nach dem Icon in der linken oberen Ecke<br />
eines Fensters gefragt wurde. Leider sind die Treads nicht weiter behandelt worden.<br />
Habe mich daran gemacht bei meinem Programm auch mal ein Icon anzeigen zu lassen,<br />
und nicht immer dieses weisse Viereck.</p>
<p>Nun ist der Code zwar aus einem Tuturial uebernommen in dem auch mit Dev-C++ gearbeitet<br />
wurde, nur leider funzt es nicht so wie es soll. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Hier mal ein wenig Code</p>
<pre><code class="language-cpp">//main.c

#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;time.h&gt;
#include &lt;stdbool.h&gt;
#include &quot;resource.h&quot;

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

char szClassName[ ] = &quot;WindowsApp&quot;;

int WINAPI
WinMain (HINSTANCE hThisInstance,
         HINSTANCE hPrevInstance,
         LPSTR lpszArgument,
         int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;   /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);
    wincl.hIcon = LoadIcon (GetModuleHandle(NULL), MAKEINTRESOURCE(ID_ICON));
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use actual Windows's color as the background of the window */
    wincl.hbrBackground = (HBRUSH) GetSysColorBrush(COLOR_WINDOW); //rueckgabewert von GetSysColorBrush wird gecastet

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&amp;wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;Nicos Alter 5&quot;,       /* Title Text */
           WS_BORDER | WS_SYSMENU, /* thin border, size can't be change with close button */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           200,                 /* The programs width */
           120,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;

}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK
WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

HDC hdc;		/* A device context used for drawing */
PAINTSTRUCT ps;	/* Also used during window drawing */
RECT rc;		/* A rectangle used during drawing */

const UINT TimerID = 1;    
const int iDelay = 1000;        //    = Zeit einstellen

    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
            {
            	SetTimer(hwnd, TimerID, iDelay, NULL); //Timer setzen
            	return 0;

            }

        case WM_TIMER:
           { 
                berechne_alter();    
                InvalidateRect(hwnd, NULL, TRUE); 
            	return 0;
            	break;

           }    
        case WM_DESTROY:
            {
            	KillTimer(hwnd, TimerID);	//nicht vergessen den Timer zu loeschen!!!
             	PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            	break;
            }

        case WM_PAINT:
            {
            	/* The window needs to be painted (redrawn). */
            	hdc = BeginPaint (hwnd, &amp;ps);
            	GetClientRect (hwnd, &amp;rc);

                //Hintergrund der Schriftart transparent machen
                SetBkMode(hdc,TRANSPARENT);	

                //den Text ausgeben
                DrawText (hdc, (LPCTSTR)&amp;cText, -1, &amp;rc, 
               	DT_SINGLELINE | DT_CENTER | DT_VCENTER );

               	EndPaint (hwnd, &amp;ps);
                return 0;
                break;
        }    
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
</code></pre>
<p>die resource.h</p>
<pre><code class="language-cpp">#define ID_ICON		111
</code></pre>
<p>und zu guter letzt noch resource.rc</p>
<pre><code class="language-cpp">ID_ICON		ICON		&quot;NicosAlter.ico&quot;
</code></pre>
<p>Die Icondatei liegt im selben Verzeichniss wie alle anderen Dateien.<br />
(*.c; *.h; *.rc usw.)</p>
<p>Hat jemand eine Idee warum das Icon nur in der Taskleiste angezeigt wird? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/631045</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/631045</guid><dc:creator><![CDATA[haderlump22]]></dc:creator><pubDate>Sun, 17 Oct 2004 18:49:35 GMT</pubDate></item><item><title><![CDATA[Reply to Icon nicht neben Fenstertitel trotz resource!!! on Sun, 17 Oct 2004 19:28:46 GMT]]></title><description><![CDATA[<p>Hier liegt der Fehler:</p>
<pre><code class="language-cpp">wincl.hIcon = LoadIcon (GetModuleHandle(NULL), MAKEINTRESOURCE(ID_ICON)); 
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
</code></pre>
<p>Mache es so:</p>
<pre><code class="language-cpp">wincl.hIcon = LoadIcon (hThisInstance, MAKEINTRESOURCE(ID_ICON)); 
    wincl.hIconSm = LoadIcon (hThisInstance, MAKEINTRESOURCE(ID_ICON));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/631081</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/631081</guid><dc:creator><![CDATA[MiC++ha]]></dc:creator><pubDate>Sun, 17 Oct 2004 19:28:46 GMT</pubDate></item><item><title><![CDATA[Reply to Icon nicht neben Fenstertitel trotz resource!!! on Sun, 17 Oct 2004 19:50:45 GMT]]></title><description><![CDATA[<p>Danke fuer den Tip!<br />
Leider aber immer noch so. Das Icon wird nur in der Taskleiste angezeigt.<br />
Im Fenster bleibt es bei dem weissen Viereck (Standardsymbol?).</p>
<p>Eventuell ein Problem mit der IDE (Dev-C++) <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/631095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/631095</guid><dc:creator><![CDATA[haderlump22]]></dc:creator><pubDate>Sun, 17 Oct 2004 19:50:45 GMT</pubDate></item><item><title><![CDATA[Reply to Icon nicht neben Fenstertitel trotz resource!!! on Sun, 17 Oct 2004 22:33:27 GMT]]></title><description><![CDATA[<blockquote>
<p>Eventuell ein Problem mit der IDE (Dev-C++)</p>
</blockquote>
<p>Nein!</p>
<p>So wie ich es Vorgab funktioniert es.</p>
<p>a. #include &quot;resource.h&quot; muß in der resource.rc und in der main.cpp stehen<br />
b. projektOptionen-&gt;Dateien auf &quot;recourcen.rc&quot; klicken und hacken rein bei &quot;In kompilation einbeziehen&quot;<br />
c. das so machen wie ich es vorgab.</p>
<p>wenn es jetzt immer noch nicht geht liegt der Fehler wo anders<br />
nur wo?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/631187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/631187</guid><dc:creator><![CDATA[MiC++ha]]></dc:creator><pubDate>Sun, 17 Oct 2004 22:33:27 GMT</pubDate></item><item><title><![CDATA[Reply to Icon nicht neben Fenstertitel trotz resource!!! on Mon, 18 Oct 2004 06:33:09 GMT]]></title><description><![CDATA[<p>Super das wars! Danke! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Hatte die &quot;resource.h&quot; in der &quot;resource.rc&quot; nicht includiert!<br />
Das Haeckchen, zum einkompilieren der resource.rc war bereits gesetzt.</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/631235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/631235</guid><dc:creator><![CDATA[haderlump22]]></dc:creator><pubDate>Mon, 18 Oct 2004 06:33:09 GMT</pubDate></item></channel></rss>