<?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[Probleme mit Button]]></title><description><![CDATA[<p>Bei meinem Programm wird ein Button erzeugt jedoch nicht korrekt angezeigt.<br />
Ich habe schon herumprobiert aber komme nicht drauf. Shade das man keine Dateien Uploaden kann. Deshalb hier der Code<br />
///////////////////////////////////////////////////////////////////////////////<br />
#include &lt;windows.h&gt;</p>
<p>struct to<br />
{<br />
int ox;<br />
int oy;<br />
int ow;<br />
int oh;</p>
<p>}g;<br />
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);</p>
<p>int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szCmdLine, int iCmdShow)<br />
{<br />
char szName[] = &quot;Fensterklasse&quot;;<br />
WNDCLASS wc;</p>
<p>wc.style = CS_HREDRAW | CS_VREDRAW;<br />
wc.lpfnWndProc = WndProc;<br />
wc.cbClsExtra = 0;<br />
wc.cbWndExtra = 0;<br />
wc.hInstance = hI;<br />
wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);<br />
wc.hCursor = LoadCursor (NULL, IDC_ARROW);<br />
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);<br />
wc.lpszMenuName = NULL;<br />
wc.lpszClassName = szName;</p>
<p>RegisterClass (&amp;wc);</p>
<p>HWND hwnd = CreateWindow (szName, &quot;&quot;, WS_OVERLAPPEDWINDOW,<br />
200, 200, 600, 600, NULL, NULL, hI, NULL);</p>
<p>ShowWindow (hwnd, iCmdShow);<br />
UpdateWindow (hwnd);</p>
<p>MSG msg;<br />
while (GetMessage (&amp;msg, NULL, 0, 0))<br />
{<br />
TranslateMessage (&amp;msg);<br />
DispatchMessage (&amp;msg);<br />
}</p>
<p>return msg.wParam;<br />
}</p>
<p>LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
HDC hdc;<br />
PAINTSTRUCT ps;<br />
HWND hwndb1;</p>
<p>g.ox = 0;<br />
g.oy = 0;<br />
g.ow = 100;<br />
g.oh = 50;</p>
<p>double i = 0;</p>
<p>switch (message)<br />
{<br />
case WM_PAINT:<br />
hdc = BeginPaint (hwnd, &amp;ps);<br />
SetStretchBltMode(hdc,BLACKONWHITE);<br />
while((g.ox + i) &lt;= 400 &amp;&amp; (g.oy + i) &lt;= 400)<br />
{<br />
Rectangle(hdc, (g.ox + i), (g.oy +i),(g.ow + i), (g.oh +i));<br />
i+= 0.0005;<br />
}<br />
EndPaint (hwnd, &amp;ps);<br />
hwndb1 = CreateWindow(&quot;button&quot;, &quot;SNAKE&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, (g.ox+i), (g.oy+i), g.ow, g.oh, hwnd, NULL, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL);<br />
return 0;<br />
case WM_COMMAND:<br />
PostQuitMessage (0);</p>
<p>case WM_DESTROY:<br />
PostQuitMessage (0);<br />
return 0;<br />
}</p>
<p>return DefWindowProc (hwnd, message, wParam, lParam);<br />
}<br />
/////////////////////////////////////////////////////////////////////////////</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/80504/probleme-mit-button</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 04:37:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/80504.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Jul 2004 18:54:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit Button on Wed, 21 Jul 2004 18:54:24 GMT]]></title><description><![CDATA[<p>Bei meinem Programm wird ein Button erzeugt jedoch nicht korrekt angezeigt.<br />
Ich habe schon herumprobiert aber komme nicht drauf. Shade das man keine Dateien Uploaden kann. Deshalb hier der Code<br />
///////////////////////////////////////////////////////////////////////////////<br />
#include &lt;windows.h&gt;</p>
<p>struct to<br />
{<br />
int ox;<br />
int oy;<br />
int ow;<br />
int oh;</p>
<p>}g;<br />
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);</p>
<p>int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, PSTR szCmdLine, int iCmdShow)<br />
{<br />
char szName[] = &quot;Fensterklasse&quot;;<br />
WNDCLASS wc;</p>
<p>wc.style = CS_HREDRAW | CS_VREDRAW;<br />
wc.lpfnWndProc = WndProc;<br />
wc.cbClsExtra = 0;<br />
wc.cbWndExtra = 0;<br />
wc.hInstance = hI;<br />
wc.hIcon = LoadIcon (NULL, IDI_WINLOGO);<br />
wc.hCursor = LoadCursor (NULL, IDC_ARROW);<br />
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);<br />
wc.lpszMenuName = NULL;<br />
wc.lpszClassName = szName;</p>
<p>RegisterClass (&amp;wc);</p>
<p>HWND hwnd = CreateWindow (szName, &quot;&quot;, WS_OVERLAPPEDWINDOW,<br />
200, 200, 600, 600, NULL, NULL, hI, NULL);</p>
<p>ShowWindow (hwnd, iCmdShow);<br />
UpdateWindow (hwnd);</p>
<p>MSG msg;<br />
while (GetMessage (&amp;msg, NULL, 0, 0))<br />
{<br />
TranslateMessage (&amp;msg);<br />
DispatchMessage (&amp;msg);<br />
}</p>
<p>return msg.wParam;<br />
}</p>
<p>LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
HDC hdc;<br />
PAINTSTRUCT ps;<br />
HWND hwndb1;</p>
<p>g.ox = 0;<br />
g.oy = 0;<br />
g.ow = 100;<br />
g.oh = 50;</p>
<p>double i = 0;</p>
<p>switch (message)<br />
{<br />
case WM_PAINT:<br />
hdc = BeginPaint (hwnd, &amp;ps);<br />
SetStretchBltMode(hdc,BLACKONWHITE);<br />
while((g.ox + i) &lt;= 400 &amp;&amp; (g.oy + i) &lt;= 400)<br />
{<br />
Rectangle(hdc, (g.ox + i), (g.oy +i),(g.ow + i), (g.oh +i));<br />
i+= 0.0005;<br />
}<br />
EndPaint (hwnd, &amp;ps);<br />
hwndb1 = CreateWindow(&quot;button&quot;, &quot;SNAKE&quot;, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, (g.ox+i), (g.oy+i), g.ow, g.oh, hwnd, NULL, (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL);<br />
return 0;<br />
case WM_COMMAND:<br />
PostQuitMessage (0);</p>
<p>case WM_DESTROY:<br />
PostQuitMessage (0);<br />
return 0;<br />
}</p>
<p>return DefWindowProc (hwnd, message, wParam, lParam);<br />
}<br />
/////////////////////////////////////////////////////////////////////////////</p>
]]></description><link>https://www.c-plusplus.net/forum/post/565450</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/565450</guid><dc:creator><![CDATA[The_incredible_Guest]]></dc:creator><pubDate>Wed, 21 Jul 2004 18:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Button on Wed, 21 Jul 2004 20:16:19 GMT]]></title><description><![CDATA[<p>Childfenster (und Dein Button ist einer) werden nicht in WM_PAINT erzeugt, sondern in WM_CREATE.</p>
<p>Dein WM_COMMAND-zweig sieht... nunja, sagen wir etwas &quot;seltsam&quot; aus.</p>
<p>Möchtest Du nicht erstmal ein WinAPI-Tutorial durcharbeiten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/565487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/565487</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Wed, 21 Jul 2004 20:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Button on Thu, 22 Jul 2004 07:04:51 GMT]]></title><description><![CDATA[<p>Ich will ja nicht einen Button erzeugen wenn die Nachricht WM_CREATE eintrifft sondern wenn die Nachricht WM_PAINT eintrifft und die &quot;Snake&quot; aus den Rechtecken erstellt wurde. Probiers aus und du siehst den Fehler:<br />
Der Button existiert zwar wird aber nur selten und durch Zufall richtig angezeigt. (Der Button wird glaube ich mehrmals erzeugt was zu merkwürdigen Grafikfehlern führt)<br />
Das würde heißen die Message WM_PAINT wird mehrmals abgeschickt.(Aber wieso?)<br />
Ich werde das mal durch ne if(bool) Entscheidung prüfen und nen bool auf false setzen wenn der Button einmal erzeugt wurde. Mal sehen was passiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/565610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/565610</guid><dc:creator><![CDATA[The_incredible_Guest]]></dc:creator><pubDate>Thu, 22 Jul 2004 07:04:51 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Button on Thu, 22 Jul 2004 07:12:59 GMT]]></title><description><![CDATA[<p>Ich habe den Code unverändert in eine andere Datei auf einem anderen Rechner kopiert und plötzlich geht alles wie es soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/565615</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/565615</guid><dc:creator><![CDATA[The_incredible_Guest]]></dc:creator><pubDate>Thu, 22 Jul 2004 07:12:59 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Button on Thu, 22 Jul 2004 07:57:36 GMT]]></title><description><![CDATA[<p>The_incredible_Guest schrieb:</p>
<blockquote>
<p>Das würde heißen die Message WM_PAINT wird mehrmals abgeschickt.(Aber wieso?)</p>
</blockquote>
<p>WM_PAINT wird vom System jedesmal dann an Dein Programm geschickt, sobald dein Fenster neu gezeichnet werden muß.<br />
z. B.: Wird Dein Programmfenster von einem anderen Fenster überlappt -&gt; WM_PAINT</p>
<p>Siehe auch:<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_88ac.asp" rel="nofollow">MSDN: WM_PAINT</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/565647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/565647</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Thu, 22 Jul 2004 07:57:36 GMT</pubDate></item></channel></rss>