<?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[DialogBox: Icon fehler]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>In dem folgenden Dialog wird das Icon hProgramIcon (in WinMain) nicht geladen.</p>
<p>warum??? es ist in der Resource, die ist da, aber nix ladet!</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;math.h&gt;

#include &quot;res.h&quot;

#include &quot;DisplaySettings.h&quot;

TCHAR AppName[] = &quot;FreeHome&quot;;
NOTIFYICONDATA nidTray;
HICON hProgramIcon;

INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_INITDIALOG:
		// As first make icon load
		// Make the dialog icon
		SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hProgramIcon);
		SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hProgramIcon);

		// Prepare Tray icon to be shown by minimizing
		nidTray.cbSize = sizeof(nidTray);
		nidTray.hIcon = hProgramIcon;
		nidTray.hWnd = hDlg;
		nidTray.uCallbackMessage = (WM_USER + 1);
		nidTray.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
		nidTray.uID = 0x0200;
		lstrcpy(nidTray.szTip,AppName);
		nidTray.szTip[lstrlen(nidTray.szTip)] = '\0';
		return 0;
	case WM_CLOSE:
		EndDialog(hDlg,IDOK);
		return 0;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
			return 0;
		}
		return 0;
	case WM_SYSCOMMAND:
		switch (wParam)
		{
		case SC_MINIMIZE:
			// Hide window
			ShowWindow(hDlg,SW_HIDE);

			// make to tray
			Shell_NotifyIcon(NIM_ADD, &amp;nidTray);
			return 0;
		case SC_RESTORE:
			// make window in foreground
			SetForegroundWindow(hDlg);

			// Remove tray
			Shell_NotifyIcon(NIM_DELETE, &amp;nidTray);
			return 0;
		}
		return 0;
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR     lpCmdLine,
				   int       nShowCmd)
{
	hProgramIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_ICN1));
	if (!hProgramIcon)
	{
		MessageBox(NULL,&quot;Could not load main application icon.&quot;,&quot;Fatal Error&quot;,
			MB_OK | MB_ICONERROR);
		return 1;
	}

	DialogBox(hInstance,MAKEINTRESOURCE(IDD_DLG1),NULL,DialogProc);
	return 0;
}
</code></pre>
<p>Außerdem: es erscheint ein TrayIcon, aber es ist leer! durchsichtig.<br />
aber es ist immernoch der Button in der Task leiste.<br />
das möchte ich nicht. ich möchte nur, dass das TrayIcon da ist.</p>
<p>Woran könnte das liegen?</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/191345/dialogbox-icon-fehler</link><generator>RSS for Node</generator><lastBuildDate>Wed, 01 Jul 2026 13:38:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/191345.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2007 19:48:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DialogBox: Icon fehler on Sat, 01 Sep 2007 19:48:37 GMT]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>In dem folgenden Dialog wird das Icon hProgramIcon (in WinMain) nicht geladen.</p>
<p>warum??? es ist in der Resource, die ist da, aber nix ladet!</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;math.h&gt;

#include &quot;res.h&quot;

#include &quot;DisplaySettings.h&quot;

TCHAR AppName[] = &quot;FreeHome&quot;;
NOTIFYICONDATA nidTray;
HICON hProgramIcon;

INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
	case WM_INITDIALOG:
		// As first make icon load
		// Make the dialog icon
		SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hProgramIcon);
		SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hProgramIcon);

		// Prepare Tray icon to be shown by minimizing
		nidTray.cbSize = sizeof(nidTray);
		nidTray.hIcon = hProgramIcon;
		nidTray.hWnd = hDlg;
		nidTray.uCallbackMessage = (WM_USER + 1);
		nidTray.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
		nidTray.uID = 0x0200;
		lstrcpy(nidTray.szTip,AppName);
		nidTray.szTip[lstrlen(nidTray.szTip)] = '\0';
		return 0;
	case WM_CLOSE:
		EndDialog(hDlg,IDOK);
		return 0;
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
			return 0;
		}
		return 0;
	case WM_SYSCOMMAND:
		switch (wParam)
		{
		case SC_MINIMIZE:
			// Hide window
			ShowWindow(hDlg,SW_HIDE);

			// make to tray
			Shell_NotifyIcon(NIM_ADD, &amp;nidTray);
			return 0;
		case SC_RESTORE:
			// make window in foreground
			SetForegroundWindow(hDlg);

			// Remove tray
			Shell_NotifyIcon(NIM_DELETE, &amp;nidTray);
			return 0;
		}
		return 0;
	}
	return 0;
}

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR     lpCmdLine,
				   int       nShowCmd)
{
	hProgramIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_ICN1));
	if (!hProgramIcon)
	{
		MessageBox(NULL,&quot;Could not load main application icon.&quot;,&quot;Fatal Error&quot;,
			MB_OK | MB_ICONERROR);
		return 1;
	}

	DialogBox(hInstance,MAKEINTRESOURCE(IDD_DLG1),NULL,DialogProc);
	return 0;
}
</code></pre>
<p>Außerdem: es erscheint ein TrayIcon, aber es ist leer! durchsichtig.<br />
aber es ist immernoch der Button in der Task leiste.<br />
das möchte ich nicht. ich möchte nur, dass das TrayIcon da ist.</p>
<p>Woran könnte das liegen?</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357020</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 01 Sep 2007 19:48:37 GMT</pubDate></item><item><title><![CDATA[Reply to DialogBox: Icon fehler on Sat, 01 Sep 2007 21:02:17 GMT]]></title><description><![CDATA[<p>naja, das prob mit dem Icon habe ich geölst.</p>
<p>aber kann es sein, dass ich die Minimier-Message abfangen muss, so dass er nicht mehr minimiert, sondern nur noch das Fenster unsichtbar macht???</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357066</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357066</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 01 Sep 2007 21:02:17 GMT</pubDate></item><item><title><![CDATA[Reply to DialogBox: Icon fehler on Sun, 02 Sep 2007 00:44:05 GMT]]></title><description><![CDATA[<p>Script-Styler schrieb:</p>
<blockquote>
<p>aber kann es sein, dass ich die Minimier-Message abfangen muss, so dass er nicht mehr minimiert, sondern nur noch das Fenster unsichtbar macht???</p>
</blockquote>
<p>Kannst du so machen, wird dann aber halt nicht mehr unten in der Taskleiste angezeigt... Ich versteh den Nutzen nicht ganz <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/1357125</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357125</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 02 Sep 2007 00:44:05 GMT</pubDate></item><item><title><![CDATA[Reply to DialogBox: Icon fehler on Sun, 02 Sep 2007 09:12:13 GMT]]></title><description><![CDATA[<p>Der Nutzen ist, dass das Programm im Hintergrund läuft und man es nur ausm tray wieder aufrufen kann. es hat ein Menü, wo man dann noch aktionen machen kann.</p>
<p>Aber das Prob ist gelöst^^.</p>
<p>thx.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357159</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357159</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sun, 02 Sep 2007 09:12:13 GMT</pubDate></item><item><title><![CDATA[Reply to DialogBox: Icon fehler on Sun, 02 Sep 2007 10:09:19 GMT]]></title><description><![CDATA[<p>Script-Styler schrieb:</p>
<blockquote>
<p>Aber das Prob ist gelöst^^.</p>
<p>thx.</p>
</blockquote>
<p>Erst Fragen, dann suchen, was? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357175</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357175</guid><dc:creator><![CDATA[gosha16]]></dc:creator><pubDate>Sun, 02 Sep 2007 10:09:19 GMT</pubDate></item><item><title><![CDATA[Reply to DialogBox: Icon fehler on Sun, 02 Sep 2007 11:42:12 GMT]]></title><description><![CDATA[<p>nein nein, das ist quatch.</p>
<p>ich hab schon gesucht und probiert.</p>
<p>aber dann ist mir der Fehler beim Weiterarbeiten aufgefallen.</p>
<p>Ich hatte einfach die falsche Message benutzt.^^</p>
<p>naja, ist ja auch egal.</p>
<p>thx jedenfalls.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1357228</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1357228</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sun, 02 Sep 2007 11:42:12 GMT</pubDate></item></channel></rss>