<?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[Layered Window Problem]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>ich habe folgende Fragen zu den Layered Windows:</p>
<p>1. wie kann ich, wenn ich den WS_EX_LAYERED-Style gesetzt habe, einen Hintergrund wählen, den der dann transparent macht und alles andere anzeigt?<br />
2. Mit WS_EX_TOPMOST mache ich das in den Vordergrund.</p>
<p>Bei mir macht er das gesammte fenster durchsichtig, wenn ich WS_EX_LAYERED angebe.<br />
woran kann das liegen???</p>
<p>danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/189885/layered-window-problem</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 16:32:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/189885.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Aug 2007 23:32:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Layered Window Problem on Fri, 17 Aug 2007 23:32:10 GMT]]></title><description><![CDATA[<p>Hi @ All.</p>
<p>ich habe folgende Fragen zu den Layered Windows:</p>
<p>1. wie kann ich, wenn ich den WS_EX_LAYERED-Style gesetzt habe, einen Hintergrund wählen, den der dann transparent macht und alles andere anzeigt?<br />
2. Mit WS_EX_TOPMOST mache ich das in den Vordergrund.</p>
<p>Bei mir macht er das gesammte fenster durchsichtig, wenn ich WS_EX_LAYERED angebe.<br />
woran kann das liegen???</p>
<p>danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346720</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346720</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Fri, 17 Aug 2007 23:32:10 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 00:02:33 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-187535" rel="nofollow">Schon wieder alles vergessen ?</a></p>
<p><a href="http://msdn2.microsoft.com/en-us/library/ms633540.aspx" rel="nofollow">SetLayeredWindowAttributes ()</a></p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346725</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 18 Aug 2007 00:02:33 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 09:42:28 GMT]]></title><description><![CDATA[<p>nee, nich schon wieder alles vergessen^^.</p>
<p>ich habs versucht, aber es klappt nicht!</p>
<p>Das bild wird geblittet, passent auf das Fenster, aber das Fenster ist trotz Aufruf von SetLayeredWindowAttributes() unsichtbar...</p>
<p>hier mein Sourcecode:</p>
<pre><code class="language-cpp">#pragma once

class CSkullWindow
{
public:
	CSkullWindow(HINSTANCE hInst);
	~CSkullWindow(void);

	// The default window procedure with access to all class variables
	LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

	// The static window procedure will call the not-static one
	static LRESULT CALLBACK WndProcStatic(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);

	HINSTANCE	hInstance;
	HWND		hWnd;
	WNDCLASSEX	wClass;
};
// -------------------------------------------------------------------------
#pragma comment(lib, &quot;Msimg32.lib&quot;)

#define _WIN32_WINNT 0x0500
#include &lt;windows.h&gt;
#include &quot;SkullWindow.h&quot;
#include &quot;script.h&quot;

CSkullWindow::CSkullWindow(HINSTANCE hInst)
{
	hInstance = hInst;
	MSG msg;

	FillMemory (&amp;wClass,sizeof(WNDCLASSEX),0);
	wClass.cbSize			= sizeof(WNDCLASSEX);
	wClass.style			= CS_HREDRAW | CS_VREDRAW;
	wClass.lpfnWndProc		= WndProcStatic;
	wClass.cbClsExtra		= 0;
	wClass.cbWndExtra		= 0;
	wClass.hInstance		= hInstance;
	wClass.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
	wClass.hCursor			= LoadCursor(NULL, IDC_ARROW);
	wClass.hbrBackground	= (HBRUSH) GetStockObject(WHITE_BRUSH);
	wClass.lpszMenuName		= NULL;
	wClass.lpszClassName	= &quot;Skull Window&quot;;
	wClass.hIconSm			= wClass.hIcon;

	if (!RegisterClassEx(&amp;wClass))
	{
		CSkullWindow::~CSkullWindow();
	}

	hWnd = CreateWindowEx(
			WS_EX_LAYERED | WS_EX_TOPMOST,
			&quot;Skull Window&quot;,
			&quot;Skull Window&quot;,
			WS_POPUP,
			CW_USEDEFAULT,
			CW_USEDEFAULT,
			CW_USEDEFAULT,
			CW_USEDEFAULT,
			NULL,
			NULL,
			hInstance,
			this);

	ShowWindow(hWnd,1);
	UpdateWindow(hWnd);

	while (GetMessage(&amp;msg,NULL,0,0))
	{
		TranslateMessage(&amp;msg);
		DispatchMessage(&amp;msg);
	}
}

CSkullWindow::~CSkullWindow(void)
{
}

LRESULT CALLBACK CSkullWindow::WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
	HDC hdc,cachedc;
	RECT rect;
	HBITMAP hbitmap;
	switch (Message)
	{
	case WM_CREATE:
		return 0;
	case WM_PAINT:
		hdc = BeginPaint(hwnd,&amp;ps);
		GetClientRect(hwnd,&amp;rect);
		cachedc = CreateCompatibleDC(hdc);
		hbitmap = (HBITMAP)LoadBitmap(hInstance,MAKEINTRESOURCE(BITMAP_0));
		SelectObject(cachedc,hbitmap);

		TransparentBlt(hdc,
			rect.left,rect.top,
			rect.right-rect.left,rect.bottom-rect.top,
			cachedc,
			0,0,
			506,327,
			RGB(255,0,255));

		SelectObject(cachedc,hbitmap);
		DeleteObject(hbitmap);
		DeleteDC(cachedc);

		EndPaint(hwnd,&amp;ps);
		return 0;
	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;
	default:
		return DefWindowProc(hWnd,Message,wParam,lParam);
	}
}

LRESULT CALLBACK CSkullWindow::WndProcStatic(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	if (Message == WM_CREATE)
	{
		SetWindowLong(hwnd,GWL_USERDATA,(LONG)((LPCREATESTRUCT)lParam) -&gt; lpCreateParams);

		// Make this window visible
        SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
	}
	CSkullWindow *pThis = (CSkullWindow *) GetWindowLong(hwnd,GWL_USERDATA);

	if (pThis == 0)
	{
		return DefWindowProc(hwnd,Message,wParam,lParam);
	}
	else
	{
		return pThis -&gt; WndProc(hwnd,Message,wParam,lParam);
	}
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1346787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346787</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 09:42:28 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 13:08:46 GMT]]></title><description><![CDATA[<p>Guck mal nach, welchen Fenster-<strong>Style</strong> Du sonst immer für ein Hauptfenster benutzt hast.<br />
Danach sorge dafür, dass die GetMessage-Schleife aus dem Konstruktor verschwindet (gehört in die WinMain !).<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346896</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 18 Aug 2007 13:08:46 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 15:46:29 GMT]]></title><description><![CDATA[<p>die Message-Loop gehört in die WinMain??? aber das fenster ist doch in der Klasse.<br />
Wofür ist der Message-Loop überhaupt??? --&gt; Man hat doch die WndProc.<br />
außerdem greift er nur auf msg zu und was soll dass denn?</p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346979</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 15:46:29 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 15:35:50 GMT]]></title><description><![CDATA[<p>so, jetzt habe ich statt WS_POPUP WS_OVERLAPPEDWINDOW benutzt.</p>
<p>aber jetzt ist das Fenster zwar sichtbar, aber es hat wieder einen Rahmen und so.</p>
<p>sry, dass ich hier nerve, aber irgendwie muss ich das ja mal lernen.</p>
<p>thx.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346983</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346983</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 15:35:50 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 15:55:52 GMT]]></title><description><![CDATA[<p>Die MessageLoop sorgt ja gerade dafür das die WindowProc überhaupt aufgerufen wird <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=";D"
      alt="😉"
    /><br />
Schau dir mal die doku zu DispatchMessage() an!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346991</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 18 Aug 2007 15:55:52 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 16:00:20 GMT]]></title><description><![CDATA[<p>ja danke.<br />
jetzt habe ich es auch verstanden:<br />
das ist dafür, dass das Programm nicht direkt beendet wird, sobald er mit dem Erstellen des Fensters fertig ist. es soll erst beendet werden, wenn die Quit-Message da ist.</p>
<p>yo, aber das Layered Window, um das es hier geht, geht immer noch verkehrt. Trotz WS_EX_LAYERED. kann mir einer mal sagen warum dass so ist? in der WndProc wird bei WM_CREATE doch das LayeredindowAttributes-viech aufgerufen. dass soll ja auch so sein, aber verstehe ich nicht, was dort verkehrt ist.<br />
Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1346994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1346994</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 16:00:20 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 19:45:13 GMT]]></title><description><![CDATA[<p>merker schrieb:</p>
<blockquote>
<p>Guck mal nach, welchen Fenster-<strong>Style</strong> Du sonst immer für ein Hauptfenster benutzt hast.</p>
</blockquote>
<p>Funktioniert WS_EX_LAYERED nicht zusammen mit WS_POPUP ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347064</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347064</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 18 Aug 2007 19:45:13 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 21:05:48 GMT]]></title><description><![CDATA[<p>geeky schrieb:</p>
<blockquote>
<p>merker schrieb:</p>
<blockquote>
<p>Guck mal nach, welchen Fenster-<strong>Style</strong> Du sonst immer für ein Hauptfenster benutzt hast.</p>
</blockquote>
<p>Funktioniert WS_EX_LAYERED nicht zusammen mit WS_POPUP ?</p>
</blockquote>
<p>was denn dann???<br />
ich hab schon viel versucht, aber irgendwie will das nicht funzen...</p>
<p>danke danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347095</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 21:05:48 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 21:35:08 GMT]]></title><description><![CDATA[<p>geeky schrieb:</p>
<blockquote>
<p>Funktioniert WS_EX_LAYERED nicht zusammen mit WS_POPUP ?</p>
</blockquote>
<p>Doch. Perfekt sogar. War wohl bischen kryptisch mein Beitrag. Sorry.</p>
<p>Script-Styler schrieb:</p>
<blockquote>
<p>aber irgendwie will das nicht funzen...</p>
</blockquote>
<p>Es &quot;funzt&quot; perfekt. Hast Du ja gesehen bei WS_OVERLAPPEDWINDOW. Offenbar stimmt was mit der Grösse nicht.<br />
Wie gross ist ein WS_POPUP mit CW_USEDEFAULT ? Setze da mal Zahlen ein.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347106</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 18 Aug 2007 21:35:08 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 21:38:31 GMT]]></title><description><![CDATA[<p>lol <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1347108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347108</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 18 Aug 2007 21:38:31 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 21:45:48 GMT]]></title><description><![CDATA[<p>Danke danke mann!</p>
<p>Aber mein Problem ist nun, dass ich ein Bitmap mit lilanem Hintergrund RGB(255,0,255) einblende.<br />
Aber wie bekomme ich diese Farbe nun transparent???</p>
<p>danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347113</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 21:45:48 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 22:45:21 GMT]]></title><description><![CDATA[<p>Dann solltest du SetLayeredWindowAttributes() nicht mit Alpha-Wert benutzen, sondern mit LWA_COLORKEY und crKey auf dein lila setzen.<br />
Dann brauchst du auch kein TransparentBlt().<br />
Dein Fenster wird dann an allen Stellen wo eigentlich lila ist vollkommen transparent.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347132</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347132</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 18 Aug 2007 22:45:21 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 23:10:03 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">SetLayeredWindowAttributes(hwnd, RGB(255,0,255), 0, LWA_COLORKEY);
</code></pre>
<p>Aber wie bekomme ich es hin, dass unten in der Taskleiste kein!!! Programm mehr angezeigt wird???<br />
gibt es da nicht so ein ex-style dafür??</p>
<p>thx.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347137</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347137</guid><dc:creator><![CDATA[Script-Styler]]></dc:creator><pubDate>Sat, 18 Aug 2007 23:10:03 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 23:35:19 GMT]]></title><description><![CDATA[<p>Ein ToolWindow (WS_EX_TOOLWINDOW) hat glaube ich keinen Taskbar-Button.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347141</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 18 Aug 2007 23:35:19 GMT</pubDate></item><item><title><![CDATA[Reply to Layered Window Problem on Sat, 18 Aug 2007 23:47:34 GMT]]></title><description><![CDATA[<p>Stimmt. WS_EX_TOOLWINDOW erzeugt keinen Taskbar-Button.<br />
Allerdings lässt sich zusammen mit den anderen ExStyles dann kein MSDN-Designer-Richtlinien-Wettbewerb mehr gewinnen.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1347144</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1347144</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 18 Aug 2007 23:47:34 GMT</pubDate></item></channel></rss>