<?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[Status bar erstellen???[!! solved !!]]]></title><description><![CDATA[<p>Hallo und Guten Tag.</p>
<p>Ich versuch nun schon eine geraume Zeit so eine Statusbar zu erstellen und im Fenster anzuzeigen.</p>
<p>Ich erstelle also ein Window handle so</p>
<pre><code>bool CreateStatusBar(const TCHAR *szClassName, HWND hwndParent, 
					 HINSTANCE hInstance, WNDPROC proc, short id, HWND *phwnd)
{
	WNDCLASS wc = { NULL };

	wc.hbrBackground	= (HBRUSH)GetStockObject(COLOR_BTNFACE);
	wc.hInstance		= hInstance;
	wc.lpfnWndProc		= proc;
	wc.lpszClassName	= szClassName;
	wc.style			= CS_VREDRAW | CS_HREDRAW;

	if(!RegisterClass(&amp;wc)){
		MessageBox(NULL, TEXT(&quot;Requires Windows NT!&quot;), TEXT(&quot;Statusbar.&quot;), 
			MB_ICONERROR | MB_OK);

		return false;
	}

	HWND hwnd = CreateWindow(szClassName, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
		0,0,0,0, hwndParent, (HMENU) id, hInstance, NULL);

	if(hwnd)
		phwnd[id] = hwnd;
	else
		return false;

	return true;
}
</code></pre>
<p>und die Proc dazu ist auch ganz einfach</p>
<pre><code>LRESULT CALLBACK StatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

	HWND	hParent;
	RECT	rParent;
	HDC		hdcParent = NULL, hdc = NULL;

	TEXTMETRIC	tm;

	int x, y, width, height, cyChar;

	switch(msg)
	{
	case WM_CREATE:
		hParent = (HWND)GetWindowLong(hwnd, GWL_HWNDPARENT);
		hdcParent = GetDC(hParent);
		GetTextMetrics(hdcParent, &amp;tm);

		cyChar = tm.tmHeight + tm.tmExternalLeading;

		GetClientRect(hParent, &amp;rParent);

		x		= rParent.left;
		y		= rParent.bottom;
		width	= rParent.right;
		height	= cyChar;

		MoveWindow(hwnd, x, y-height, width, height, false);

		return 0;

	}
	return DefWindowProc(hwnd, msg, wParam, lParam);
}
</code></pre>
<p>Oder mach ich das total falsch?<br />
Eine vordefinierte Klasse gibt es nicht, ich hab die MSDN schon durch, von oben bis unten. Da steht nur STATUSCLASSNAME für den Klassennamen. Dann nehme ich mal an, ich muss die Klasse selbst erstellen.</p>
<p>Kann mir jemand weiter helfen???</p>
<p>Danke und Gruß<br />
Alex</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/153425/status-bar-erstellen-solved</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 03:42:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/153425.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Jul 2006 20:42:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Status bar erstellen???[!! solved !!] on Sun, 16 Jul 2006 21:14:01 GMT]]></title><description><![CDATA[<p>Hallo und Guten Tag.</p>
<p>Ich versuch nun schon eine geraume Zeit so eine Statusbar zu erstellen und im Fenster anzuzeigen.</p>
<p>Ich erstelle also ein Window handle so</p>
<pre><code>bool CreateStatusBar(const TCHAR *szClassName, HWND hwndParent, 
					 HINSTANCE hInstance, WNDPROC proc, short id, HWND *phwnd)
{
	WNDCLASS wc = { NULL };

	wc.hbrBackground	= (HBRUSH)GetStockObject(COLOR_BTNFACE);
	wc.hInstance		= hInstance;
	wc.lpfnWndProc		= proc;
	wc.lpszClassName	= szClassName;
	wc.style			= CS_VREDRAW | CS_HREDRAW;

	if(!RegisterClass(&amp;wc)){
		MessageBox(NULL, TEXT(&quot;Requires Windows NT!&quot;), TEXT(&quot;Statusbar.&quot;), 
			MB_ICONERROR | MB_OK);

		return false;
	}

	HWND hwnd = CreateWindow(szClassName, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
		0,0,0,0, hwndParent, (HMENU) id, hInstance, NULL);

	if(hwnd)
		phwnd[id] = hwnd;
	else
		return false;

	return true;
}
</code></pre>
<p>und die Proc dazu ist auch ganz einfach</p>
<pre><code>LRESULT CALLBACK StatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

	HWND	hParent;
	RECT	rParent;
	HDC		hdcParent = NULL, hdc = NULL;

	TEXTMETRIC	tm;

	int x, y, width, height, cyChar;

	switch(msg)
	{
	case WM_CREATE:
		hParent = (HWND)GetWindowLong(hwnd, GWL_HWNDPARENT);
		hdcParent = GetDC(hParent);
		GetTextMetrics(hdcParent, &amp;tm);

		cyChar = tm.tmHeight + tm.tmExternalLeading;

		GetClientRect(hParent, &amp;rParent);

		x		= rParent.left;
		y		= rParent.bottom;
		width	= rParent.right;
		height	= cyChar;

		MoveWindow(hwnd, x, y-height, width, height, false);

		return 0;

	}
	return DefWindowProc(hwnd, msg, wParam, lParam);
}
</code></pre>
<p>Oder mach ich das total falsch?<br />
Eine vordefinierte Klasse gibt es nicht, ich hab die MSDN schon durch, von oben bis unten. Da steht nur STATUSCLASSNAME für den Klassennamen. Dann nehme ich mal an, ich muss die Klasse selbst erstellen.</p>
<p>Kann mir jemand weiter helfen???</p>
<p>Danke und Gruß<br />
Alex</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1098816</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1098816</guid><dc:creator><![CDATA[DeineMutter]]></dc:creator><pubDate>Sun, 16 Jul 2006 21:14:01 GMT</pubDate></item><item><title><![CDATA[Reply to Status bar erstellen???[!! solved !!] on Sun, 16 Jul 2006 21:13:29 GMT]]></title><description><![CDATA[<p>ok, ich habs doch noch geschafft.</p>
<p>Anscheinent muss man vorher</p>
<pre><code>...
InitCommonControls();
...
</code></pre>
<p>aufrufen. Und dann kann man auch</p>
<pre><code>STATUSCLASSNAME
</code></pre>
<p>als Klassennamen verwenden.</p>
<p>Danke<br />
Alex</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1098839</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1098839</guid><dc:creator><![CDATA[DeineMutter]]></dc:creator><pubDate>Sun, 16 Jul 2006 21:13:29 GMT</pubDate></item></channel></rss>