<?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]]></title><description><![CDATA[<p>wie kann ich ein icon auf in mein programm einbauen habe ma ein kleinen tip bekommen aber ich raffs net.</p>
<p>bisheriger code:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;
#define IDI_MYICON  101
const char g_szClassName[] = &quot;myWindowClass&quot;;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_LBUTTONDOWN:
        {
            char szFileName[MAX_PATH];
            HINSTANCE hInstance = GetModuleHandle(NULL);

            GetModuleFileName(hInstance, szFileName, MAX_PATH);
            MessageBox(hwnd, szFileName, &quot;Path:&quot;, MB_OK | MB_ICONINFORMATION);
        }
        break;
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{

    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;

    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if(!RegisterClassEx(&amp;wc))
    {
        MessageBox(NULL, &quot;Window Registration Failed!&quot;, &quot;Error!&quot;,
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        &quot;Where I am&quot;,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL, &quot;Window Creation Failed!&quot;, &quot;Error!&quot;,
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
    {
        TranslateMessage(&amp;Msg);
        DispatchMessage(&amp;Msg);
    }
    return Msg.wParam;
}
</code></pre>
<p>resource:</p>
<pre><code class="language-cpp">#define IDI_MYICON  101

#define ID_FILE_EXIT4001
</code></pre>
<p>wo muss ich nun das hinsetzen und geht das überhaupt so?</p>
<p>IDI_MYICON ICON &quot;a.ico&quot;<br />
HICON hMyIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/135042/icon</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Jul 2026 01:44:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/135042.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Jan 2006 13:15:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to icon on Mon, 30 Jan 2006 13:15:50 GMT]]></title><description><![CDATA[<p>wie kann ich ein icon auf in mein programm einbauen habe ma ein kleinen tip bekommen aber ich raffs net.</p>
<p>bisheriger code:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &quot;resource.h&quot;
#define IDI_MYICON  101
const char g_szClassName[] = &quot;myWindowClass&quot;;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_LBUTTONDOWN:
        {
            char szFileName[MAX_PATH];
            HINSTANCE hInstance = GetModuleHandle(NULL);

            GetModuleFileName(hInstance, szFileName, MAX_PATH);
            MessageBox(hwnd, szFileName, &quot;Path:&quot;, MB_OK | MB_ICONINFORMATION);
        }
        break;
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{

    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;

    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if(!RegisterClassEx(&amp;wc))
    {
        MessageBox(NULL, &quot;Window Registration Failed!&quot;, &quot;Error!&quot;,
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        &quot;Where I am&quot;,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL, &quot;Window Creation Failed!&quot;, &quot;Error!&quot;,
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while(GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
    {
        TranslateMessage(&amp;Msg);
        DispatchMessage(&amp;Msg);
    }
    return Msg.wParam;
}
</code></pre>
<p>resource:</p>
<pre><code class="language-cpp">#define IDI_MYICON  101

#define ID_FILE_EXIT4001
</code></pre>
<p>wo muss ich nun das hinsetzen und geht das überhaupt so?</p>
<p>IDI_MYICON ICON &quot;a.ico&quot;<br />
HICON hMyIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981025</guid><dc:creator><![CDATA[techmech]]></dc:creator><pubDate>Mon, 30 Jan 2006 13:15:50 GMT</pubDate></item><item><title><![CDATA[Reply to icon on Mon, 30 Jan 2006 13:38:28 GMT]]></title><description><![CDATA[<p>Das kommt in die Fensterparameter, dahin, wo Du bis jetzt</p>
<pre><code class="language-cpp">wc.hIconSm = LoadIcon(NULL-IDI_APPLICATION)
</code></pre>
<p>stehen hast.<br />
Allerdings braucht MAKEINTRESOURCE etwas mehr Parameter. Da fehlt z. B. die Größe des Bitmaps, das Du verwenden willst (in der Regel 16x16 Pixel). Schau in der MSDN nach MAKEINTRESOURCE bzw. nach hIconSm und WndClassEx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/981046</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981046</guid><dc:creator><![CDATA[Elektronix]]></dc:creator><pubDate>Mon, 30 Jan 2006 13:38:28 GMT</pubDate></item><item><title><![CDATA[Reply to icon on Mon, 30 Jan 2006 17:58:46 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#define IDI_MYICON   101
#define ID_FILE_EXIT 102
</code></pre>
<p>und dann noch: <a href="http://www.win-api.de" rel="nofollow">www.win-api.de</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/981404</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/981404</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 30 Jan 2006 17:58:46 GMT</pubDate></item><item><title><![CDATA[Reply to icon on Tue, 31 Jan 2006 17:33:44 GMT]]></title><description><![CDATA[<p>Mit MS Visual C++ 6.0 ist das viel einfacher, auch wen er das selbe macht.<br />
Man fügt dem Projet einfach eine Ressurce Datei hinzu und der dan ein Icon.<br />
Aber wenn du diesen Compiler garnicht hast ist dieser Tipp wohl wenig hilfreich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982294</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982294</guid><dc:creator><![CDATA[Xclear]]></dc:creator><pubDate>Tue, 31 Jan 2006 17:33:44 GMT</pubDate></item><item><title><![CDATA[Reply to icon on Wed, 01 Feb 2006 07:50:42 GMT]]></title><description><![CDATA[<p>was mich grad ein wenig wundert:</p>
<pre><code class="language-cpp">wc.hIconSm = LoadIcon(NULL-IDI_APPLICATION)
</code></pre>
<p>warum ausgerechnet subtrahieren? das ergibt doch keinen sinn <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="😕"
    /><br />
wenn du kein VC++ verwendest, dann lade das icon doch vorher und übergeb ihm dann nur da handle. und handles sind nunmal ganzzahlige, positive, 32bit werte, was hier nicht der fall wäre.</p>
<p>MfG RadiatioN</p>
]]></description><link>https://www.c-plusplus.net/forum/post/982712</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/982712</guid><dc:creator><![CDATA[Radiation2K5]]></dc:creator><pubDate>Wed, 01 Feb 2006 07:50:42 GMT</pubDate></item></channel></rss>