<?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 im Fenster]]></title><description><![CDATA[<p>ich habe eine Icon Datei (MyIcon.ico) im gleichen verzeichnis liegen wie die EXE - nun versuche ich das Icon meinem Fenster zuzuweisen:</p>
<pre><code class="language-cpp">winclass.hIcon = (HICON)LoadImage(hInstance,TEXT(&quot;MyIcon.ico&quot;),IMAGE_ICON, 32, 32, LR_DEFAULTSIZE);
</code></pre>
<p>funzt aber nicht. Was mache ich falsch bzw. hat jemand einen Beispielcode rumliegen...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/153081/icon-im-fenster</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 23:32:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153081.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Jul 2006 16:25:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 16:25:18 GMT]]></title><description><![CDATA[<p>ich habe eine Icon Datei (MyIcon.ico) im gleichen verzeichnis liegen wie die EXE - nun versuche ich das Icon meinem Fenster zuzuweisen:</p>
<pre><code class="language-cpp">winclass.hIcon = (HICON)LoadImage(hInstance,TEXT(&quot;MyIcon.ico&quot;),IMAGE_ICON, 32, 32, LR_DEFAULTSIZE);
</code></pre>
<p>funzt aber nicht. Was mache ich falsch bzw. hat jemand einen Beispielcode rumliegen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096592</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096592</guid><dc:creator><![CDATA[Vertexwahn]]></dc:creator><pubDate>Wed, 12 Jul 2006 16:25:18 GMT</pubDate></item><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 16:52:58 GMT]]></title><description><![CDATA[<p>Hallo Vertexwahn,</p>
<p>arbeitest Du mit VS? Dann gibt es abhängig davon, wie Du Dein Icon im Resourcen Editor eingebunden hast mehrere Möglichkeiten.</p>
<p>a) Wenn Du ihm eine Nummer gegeben hast</p>
<pre><code class="language-cpp">winclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
</code></pre>
<p>oder</p>
<p>b) wenn Du ihm einen Namen gegeben hast</p>
<pre><code class="language-cpp">winclass.hIcon = LoadIcon(hInstance, TEXT(&quot;zugeweisenerName&quot;));
</code></pre>
<p>Viele Grüße<br />
Knecht</p>
<p>Ps.: Beim einbinden der Icons weicht das Forgers-Tutorial von der im Petzold vorgeschlagenen Methode ab!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096614</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096614</guid><dc:creator><![CDATA[Knecht]]></dc:creator><pubDate>Wed, 12 Jul 2006 16:52:58 GMT</pubDate></item><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 16:57:31 GMT]]></title><description><![CDATA[<blockquote>
<p>arbeitest Du mit VS?</p>
</blockquote>
<p>ja - aber ich möchte das icon aus einer Datei laden und nicht mit resourcen arbeiten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096617</guid><dc:creator><![CDATA[Vertexwahn]]></dc:creator><pubDate>Wed, 12 Jul 2006 16:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 17:11:57 GMT]]></title><description><![CDATA[<p>Einfach LoadIcon als zweiten Parameter den Pfad der Icon-Datei angeben.</p>
<pre><code class="language-cpp">LoadIcon(NULL,&quot;icon.ico&quot;); // Ohne Pfadangabe wird das Icon im Verzeichnis der Exe Datei verwendet
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1096619</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096619</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 12 Jul 2006 17:11:57 GMT</pubDate></item><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 17:10:50 GMT]]></title><description><![CDATA[<p>funzt irgendwie nicht hier der Code - die EXE und die ICO sind im gleichen Ordner</p>
<pre><code class="language-cpp">#define WIN32_LEAN_AND_MEAN // instructs the compiler to not include extraneous MFC overhead
#include &lt;windows.h&gt;
#include &lt;commctrl.h&gt;

LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{
	switch(msg)
	{
	case WM_DESTROY:
	PostQuitMessage(0);
	return 0;

	default: break;
	}
	return (DefWindowProc(hwnd, msg, wparam, lparam));
}

int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdline,
int nCmdShow)
{
	InitCommonControls();

	WNDCLASSEX winclass;
	winclass.cbSize = sizeof(WNDCLASSEX);
	winclass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC | CS_DBLCLKS;
	winclass.lpfnWndProc = WindowProc;
	winclass.cbClsExtra = 0; // extra class info space
	winclass.cbWndExtra = 0; // extra window info space
	winclass.hInstance = hInstance; // assign the application instance
	winclass.hIcon = (HICON)LoadImage(hInstance,TEXT(&quot;MyIcon.ico&quot;),IMAGE_ICON, 16, 16, LR_DEFAULTSIZE|LR_LOADFROMFILE);

	int error = GetLastError();

	winclass.hCursor = LoadCursor(hInstance, IDC_ARROW);
	winclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);//(HBRUSH)GetStockObject(WHITE_BRUSH);
	winclass.lpszMenuName = NULL; // the name of the menu to attach
	winclass.lpszClassName = TEXT(&quot;WINCLASS1&quot;); // the name of the class itself
	winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	RegisterClassEx(&amp;winclass);
	HWND hwnd;
	hwnd = CreateWindowEx(NULL,
	TEXT(&quot;WINCLASS1&quot;),
	TEXT(&quot;Fenstertitel&quot;),
	WS_OVERLAPPEDWINDOW | WS_VISIBLE,
	0,
	0,
	400,
	400,
	NULL, // handle to parent
	NULL, // handle to menu
	hInstance, // instance of this application
	NULL);
	if(hwnd==NULL)
	return -10;

	//UpdateWindow();
	MSG msg;
	while(GetMessage(&amp;msg, NULL, 0, 0))
	{
		// translate any accelerator keys
		TranslateMessage(&amp;msg);
		// send the message to the window proc
		DispatchMessage(&amp;msg);
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1096622</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096622</guid><dc:creator><![CDATA[Vertexwahn]]></dc:creator><pubDate>Wed, 12 Jul 2006 17:10:50 GMT</pubDate></item><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 17:18:17 GMT]]></title><description><![CDATA[<p>Naja in deinem Code verwendest du ja immer noch LoadImage und nicht LoadIcon<br />
außerdem solltest genauer angeben was nicht funktioniert weil unter &quot;funzt irgendwie nicht&quot; kann man viel verstehen.</p>
<pre><code class="language-cpp">wndClass.hIcon         = LoadIcon(NULL,&quot;icon1.ico&quot;);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1096627</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096627</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 12 Jul 2006 17:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to Icon im Fenster on Wed, 12 Jul 2006 17:18:13 GMT]]></title><description><![CDATA[<p>Kuldren schrieb:</p>
<blockquote>
<p>Naja in deinem Code verwendest du ja immer noch LoadImage und nicht LoadIcon<br />
außerdem solltest genauer angeben was nicht funktioniert weil unter &quot;funzt irgendwie nicht&quot; kann man viel verstehen.</p>
</blockquote>
<p>[cpp]<br />
#define WIN32_LEAN_AND_MEAN // instructs the compiler to not include extraneous MFC overhead<br />
#include &lt;windows.h&gt;<br />
#include &lt;commctrl.h&gt;</p>
<p>LRESULT CALLBACK WindowProc(HWND hwnd,<br />
UINT msg,<br />
WPARAM wparam,<br />
LPARAM lparam)<br />
{<br />
switch(msg)<br />
{<br />
case WM_DESTROY:<br />
PostQuitMessage(0);<br />
return 0;</p>
<p>default: break;<br />
}<br />
return (DefWindowProc(hwnd, msg, wparam, lparam));<br />
}</p>
<p>int WINAPI WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdline,<br />
int nCmdShow)<br />
{<br />
InitCommonControls();</p>
<p>WNDCLASSEX winclass;<br />
winclass.cbSize = sizeof(WNDCLASSEX);<br />
winclass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC | CS_DBLCLKS;<br />
winclass.lpfnWndProc = WindowProc;<br />
winclass.cbClsExtra = 0; // extra class info space<br />
winclass.cbWndExtra = 0; // extra window info space<br />
winclass.hInstance = hInstance; // assign the application instance<br />
winclass.hIcon = LoadIcon(NULL,TEXT(&quot;MyIcon.ico&quot;));</p>
<p>int error = GetLastError(); // <strong>&lt;- error == 0 ! aber kein Icon Sichtbar</strong></p>
<p>winclass.hCursor = LoadCursor(hInstance, IDC_ARROW);<br />
winclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);//(HBRUSH)GetStockObject(WHITE_BRUSH);<br />
winclass.lpszMenuName = NULL; // the name of the menu to attach<br />
winclass.lpszClassName = TEXT(&quot;WINCLASS1&quot;); // the name of the class itself<br />
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);<br />
RegisterClassEx(&amp;winclass);<br />
HWND hwnd;<br />
hwnd = CreateWindowEx(NULL,<br />
TEXT(&quot;WINCLASS1&quot;),<br />
TEXT(&quot;Fenstertitel&quot;),<br />
WS_OVERLAPPEDWINDOW | WS_VISIBLE,<br />
0,<br />
0,<br />
400,<br />
400,<br />
NULL, // handle to parent<br />
NULL, // handle to menu<br />
hInstance, // instance of this application<br />
NULL);<br />
if(hwnd==NULL)<br />
return -10;</p>
<p>//UpdateWindow();<br />
MSG msg;<br />
while(GetMessage(&amp;msg, NULL, 0, 0))<br />
{<br />
// translate any accelerator keys<br />
TranslateMessage(&amp;msg);<br />
// send the message to the window proc<br />
DispatchMessage(&amp;msg);<br />
}<br />
return 0;<br />
}<br />
[/cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1096629</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1096629</guid><dc:creator><![CDATA[Vertexwahn]]></dc:creator><pubDate>Wed, 12 Jul 2006 17:18:13 GMT</pubDate></item></channel></rss>