<?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[Problem mit HIWORD und LOWORD]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein kleines Problem gleich am Anfang.<br />
Ich erstelle ein Fenster, und dazu sieht meine WInMain so aus:</p>
<pre><code>int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE dummy0, PSTR dummy1, int dummy2)
{
  WNDCLASS wc;  // Fensterklasse
  HWND hwnd;    // Handle des Fensters
  MSG msg;      // Message (Nachricht)

  // Initialisiere Fensterklasse
  wc.lpfnWndProc   = WindowProc;    // Zeiger auf WindowProc, siehe oben
  wc.lpszMenuName  = NULL;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = hInstance;
  wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);     // Icon
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);         // Cursor
  wc.hbrBackground = (HBRUSH)(CreateSolidBrush(RGB(0,128,0)));         // Hintergrund
  wc.style         = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;  // Stilparameter
  wc.lpszClassName = &quot;Billiard&quot;;                       // Klassenname

  // Registriere Fensterklasse
  RegisterClass(&amp;wc);

  // Erzeuge Fenster, merke dir den Handle
  hwnd = CreateWindow(&quot;Billiard&quot;,                      // Klassenname
                      &quot;Billiard 0.0.1&quot;,                    // Titel
                      WS_OVERLAPPEDWINDOW,                // Fenstertyp
                      CW_USEDEFAULT, CW_USEDEFAULT,       // Ursprung x,y
                      600, 400,                           // Breite, Hoehe
                      NULL, NULL, hInstance, NULL);

  // Zeige Fenster
  ShowWindow(hwnd, SW_SHOW);

  // Nachrichtenschleife, Ausstieg falls GetMessage 0 liefert
  while ( GetMessage(&amp;msg, NULL, 0, 0) ) {
    TranslateMessage(&amp;msg);
    DispatchMessage(&amp;msg);      // Ruft WindowProc auf
  }

  // beende WinMain
  return msg.wParam;
}
</code></pre>
<p>Meine WindowProc sieht so aus:</p>
<pre><code>LRESULT CALLBACK WindowProc(HWND hwnd, UINT m, WPARAM wParam, LPARAM lParam)
{
  // Fenster auf
  switch ( m )
  {
        case WM_CREATE: SetTimer(hwnd, 0, dt, 0);
                        hdc = GetDC(hwnd);
                        xmax = LOWORD(lParam);
                        ymax = HIWORD(lParam);
                        init(hwnd);
                        break;

        case WM_PAINT:  ValidateRect(hwnd, 0);
                        break;

        case WM_TIMER:  ntimer++;
                        InvalidateRect(hwnd, 0, 0);
                        break;

        case WM_MOVE:
        case WM_SIZE:
                        xmax = LOWORD(lParam);
                        ymax = HIWORD(lParam);
                        init(hwnd);
                        break;

        case WM_DESTROY: KillTimer(hdc, 0);
                         PostQuitMessage(0);
                         break;

        case WM_KEYDOWN:
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDOWN:
                                break;

        default: return DefWindowProc(hwnd, m, wParam, lParam);

  }

  return 0;
}
</code></pre>
<p>Nun habe ich das Problem das bei WM_CREATE in xmax und ymax nicht die wie von mit erwarteten 600 und 400 stehen sonder in xmax 18 und in ymax 64578 oder so.<br />
Woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/94348/problem-mit-hiword-und-loword</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 00:58:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/94348.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Dec 2004 10:46:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 10:46:52 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein kleines Problem gleich am Anfang.<br />
Ich erstelle ein Fenster, und dazu sieht meine WInMain so aus:</p>
<pre><code>int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE dummy0, PSTR dummy1, int dummy2)
{
  WNDCLASS wc;  // Fensterklasse
  HWND hwnd;    // Handle des Fensters
  MSG msg;      // Message (Nachricht)

  // Initialisiere Fensterklasse
  wc.lpfnWndProc   = WindowProc;    // Zeiger auf WindowProc, siehe oben
  wc.lpszMenuName  = NULL;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = hInstance;
  wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);     // Icon
  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);         // Cursor
  wc.hbrBackground = (HBRUSH)(CreateSolidBrush(RGB(0,128,0)));         // Hintergrund
  wc.style         = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;  // Stilparameter
  wc.lpszClassName = &quot;Billiard&quot;;                       // Klassenname

  // Registriere Fensterklasse
  RegisterClass(&amp;wc);

  // Erzeuge Fenster, merke dir den Handle
  hwnd = CreateWindow(&quot;Billiard&quot;,                      // Klassenname
                      &quot;Billiard 0.0.1&quot;,                    // Titel
                      WS_OVERLAPPEDWINDOW,                // Fenstertyp
                      CW_USEDEFAULT, CW_USEDEFAULT,       // Ursprung x,y
                      600, 400,                           // Breite, Hoehe
                      NULL, NULL, hInstance, NULL);

  // Zeige Fenster
  ShowWindow(hwnd, SW_SHOW);

  // Nachrichtenschleife, Ausstieg falls GetMessage 0 liefert
  while ( GetMessage(&amp;msg, NULL, 0, 0) ) {
    TranslateMessage(&amp;msg);
    DispatchMessage(&amp;msg);      // Ruft WindowProc auf
  }

  // beende WinMain
  return msg.wParam;
}
</code></pre>
<p>Meine WindowProc sieht so aus:</p>
<pre><code>LRESULT CALLBACK WindowProc(HWND hwnd, UINT m, WPARAM wParam, LPARAM lParam)
{
  // Fenster auf
  switch ( m )
  {
        case WM_CREATE: SetTimer(hwnd, 0, dt, 0);
                        hdc = GetDC(hwnd);
                        xmax = LOWORD(lParam);
                        ymax = HIWORD(lParam);
                        init(hwnd);
                        break;

        case WM_PAINT:  ValidateRect(hwnd, 0);
                        break;

        case WM_TIMER:  ntimer++;
                        InvalidateRect(hwnd, 0, 0);
                        break;

        case WM_MOVE:
        case WM_SIZE:
                        xmax = LOWORD(lParam);
                        ymax = HIWORD(lParam);
                        init(hwnd);
                        break;

        case WM_DESTROY: KillTimer(hdc, 0);
                         PostQuitMessage(0);
                         break;

        case WM_KEYDOWN:
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDOWN:
                                break;

        default: return DefWindowProc(hwnd, m, wParam, lParam);

  }

  return 0;
}
</code></pre>
<p>Nun habe ich das Problem das bei WM_CREATE in xmax und ymax nicht die wie von mit erwarteten 600 und 400 stehen sonder in xmax 18 und in ymax 64578 oder so.<br />
Woran liegt das?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668611</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668611</guid><dc:creator><![CDATA[API Anfänger]]></dc:creator><pubDate>Wed, 08 Dec 2004 10:46:52 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 10:49:29 GMT]]></title><description><![CDATA[<blockquote>
<p>lParam<br />
Pointer to a CREATESTRUCT structure that contains information about the window being created.</p>
</blockquote>
<p>Wenn du jetzt nicht siehst das dein Code falsch ist, bist du wohl auch ein C oder C++ Anfänger.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668617</guid><dc:creator><![CDATA[~~~~~~~]]></dc:creator><pubDate>Wed, 08 Dec 2004 10:49:29 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 11:41:21 GMT]]></title><description><![CDATA[<p>Das ist ja sehr schön für dich. So werden wohl programmierinteressiert wieder vertrieben.<br />
Nur zur Info, ich habe diesen Quellcode aus einem Lernbuch für Anfänger und laut deisem Buch soll das so klappen.<br />
Bei einem Kollegen der auch den Code verwendet hat klappt es auch.<br />
So und nun kommst du. Du könntest mir ja wenigstens sagen, wie man es richtig macht...<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/668666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668666</guid><dc:creator><![CDATA[API Anfänger]]></dc:creator><pubDate>Wed, 08 Dec 2004 11:41:21 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 11:53:44 GMT]]></title><description><![CDATA[<p>WM_CREATE empfängt als lParam keine grössenangaben sondern einen pointer auf createstruct<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_create.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_create.asp</a><br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowstructures/createstruct.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowstructures/createstruct.asp</a></p>
<p>wenn die angaben haben willst sollte so aussehen</p>
<pre><code class="language-cpp">case WM_CREATE:
{   
    xmax = ((LPCREATESTRUCT)lParam)-&gt;x;
    ymax = ((LPCREATESTRUCT)lParam)-&gt;y;
    // ..
</code></pre>
<p>ps: warum rufst du zweimal init() auf?</p>
<p>[edit]<br />
klammerfehler <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/668675</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668675</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 08 Dec 2004 11:53:44 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 11:55:16 GMT]]></title><description><![CDATA[<p>Wie heißt das Buch aus dem der Code ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668677</guid><dc:creator><![CDATA[lParameter]]></dc:creator><pubDate>Wed, 08 Dec 2004 11:55:16 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 12:27:52 GMT]]></title><description><![CDATA[<p>So das Buch heißt &quot;Programmieren lernen mit C&quot; <a href="https://duckduckgo.com/?q=isbn+3827318025&amp;cppnetbooks" rel="nofollow">Programmieren lernen für Teens mit C | ISBN: 3827318025</a></p>
<p>Wenn ich das mit dem Beispiel von Miller verwende, bekomme ich eine Zugriffsverletzung. Ich mache das übrigen mit dem Borland C++ Builder 4.</p>
<p>Ich möcht doch nur in einem neuen Fenster, welches grünen Hintergrund hat, eine Linie von der linken oberen Ecke zu der rechten oberen Ecke zeichnen.</p>
<p>Wie muss ich es machen?<br />
So versuche ich es in der init Methode:</p>
<pre><code>void init(HWND hwnd)
{

  HPEN brown_pen;

  brown_pen = CreatePen( PS_SOLID, 15,RGB(0, 128, 64));
  SelectObject(hdc, brown_pen);

  MoveToEx( hdc, 0,0,NULL);
  LineTo( hdc, 34, 0 );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/668697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668697</guid><dc:creator><![CDATA[API Anfänger]]></dc:creator><pubDate>Wed, 08 Dec 2004 12:27:52 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 12:47:50 GMT]]></title><description><![CDATA[<p>hab noch nen fehler gemacht müsste cx und cy sein. <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=";)"
      alt="😉"
    /> hat aber nix mit deiner<br />
zugriffsverletzung zu tun</p>
<pre><code class="language-cpp">static int xmax, ymax;

    switch(msg)
    {
	case WM_CREATE:
              // timer etc
              // grösse und hdc und init() brauchst du hier nicht
	   break;
	case WM_SIZE:
	      xmax = LOWORD(lParam);
             ymax = HIWORD(lParam);
 	  break;
	case WM_PAINT:
        {
          HDC hdc = GetDC(hwnd);
          HPEN brown_pen;

          brown_pen = CreatePen( PS_SOLID, 15,RGB(0, 128, 64));
          SelectObject(hdc, brown_pen);

          MoveToEx( hdc, 0,0,NULL);
          LineTo( hdc, xmax, ymax );
        }
	break;
// ..
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/668708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668708</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 08 Dec 2004 12:47:50 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 12:56:46 GMT]]></title><description><![CDATA[<p>Hmm Miller, so klappt das leider auch net...<br />
Die Linie geht von der oberen linken Ecke nur bis zu einem drittel der Fensterhöhe runter und dann auch noch diagonal.<br />
Aber ich hab ne andere Lösung von einem Kollegen:</p>
<pre><code>RECT rc;

	int borderwidth = 21;

	GetClientRect (hwnd, &amp;rc);
	rect = GetWindowRect(hwnd,&amp;myrec);
	xmax = rc.right - rc.left;
	ymax = rc.bottom -  rc.top;
</code></pre>
<p>So hab ich nun in xmax und ymax die Fenstergröße drin stehen.<br />
Nur eine frage hab ich noch, wenn ich das Fenster jetzt verkleinere oder vergrößere, dann fängt es an zu flackern.</p>
<p>Wie kann ich das beseitigen??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668719</guid><dc:creator><![CDATA[API Anfänger]]></dc:creator><pubDate>Wed, 08 Dec 2004 12:56:46 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Wed, 08 Dec 2004 13:07:26 GMT]]></title><description><![CDATA[<p>API Anfänger schrieb:</p>
<blockquote>
<p>Hmm Miller, so klappt das leider auch net...<br />
Die Linie geht von der oberen linken Ecke nur bis zu einem drittel der Fensterhöhe runter und dann auch noch diagonal.</p>
</blockquote>
<p>anscheined hast du uns etwas verheimlicht <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=";)"
      alt="😉"
    /> den ich hab grad ein prog geschrieben<br />
das genau deinen anforderungen entspricht. und mein code geht <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>
<p>API Anfänger schrieb:</p>
<blockquote>
<p>Wie kann ich das beseitigen??</p>
</blockquote>
<p>&quot;Double Buffering&quot; heisst das zauberwort siehe forensuche</p>
]]></description><link>https://www.c-plusplus.net/forum/post/668731</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/668731</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Wed, 08 Dec 2004 13:07:26 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Thu, 09 Dec 2004 11:44:17 GMT]]></title><description><![CDATA[<p>Ok, mein Versuch mit DoubleBuffering klappt net so ganz.<br />
Ich sehe nur meinen grünen Hintergrund...<br />
Das habe ich bis jetzt:</p>
<pre><code>void init(HWND hwnd)
{

	HBRUSH brown_brush, green_brush, black_brush;
	HPEN brown_pen,black_pen;
	RECT rc;

	int borderwidth = 21;

	hdc = GetDC(hwnd);
	hdcbuffer = CreateCompatibleDC(hdc);

	GetClientRect (hwnd, &amp;rc);
	rect = GetWindowRect(hwnd,&amp;myrec);
	xmax = rc.right - rc.left;
	ymax = rc.bottom -  rc.top;

	brown_pen = CreatePen( PS_SOLID, borderwidth ,RGB(128, 64, 0));
	black_pen = CreatePen( PS_SOLID, 1 ,RGB(0, 0, 0));

	green_brush = CreateSolidBrush( RGB(0, 128, 0) );
	//brown_brush = CreateSolidBrush( RGB(0, 128, 64) );
	black_brush = CreateSolidBrush( RGB(0, 0, 0) );

	SelectObject(hdcbuffer, green_brush);
	Rectangle(hdcbuffer, 0,0,xmax,ymax);
	DeleteObject(green_brush);

	/*Zeichnen der braunen Banden*/
	SelectObject(hdcbuffer, brown_pen);
	MoveToEx( hdcbuffer, (int)(borderwidth/2),(int)(borderwidth/2),NULL);
	LineTo( hdcbuffer, xmax-((int)(borderwidth/2)), (int)(borderwidth/2) );
	LineTo( hdcbuffer, xmax-((int)(borderwidth/2)), ymax-((int)(borderwidth/2)) );
	LineTo( hdcbuffer, (int)(borderwidth/2), ymax-((int)(borderwidth/2)) );
	LineTo( hdcbuffer, (int)(borderwidth/2), (int)(borderwidth/2) );
	DeleteObject(brown_pen);

	/*Zeichnen der schwarzen Linie auf den Banden*/
	SelectObject(hdcbuffer, black_pen);
	MoveToEx( hdcbuffer, (int)(borderwidth/2),(int)(borderwidth/2),NULL);
	LineTo( hdcbuffer, xmax-((int)(borderwidth/2)), (int)(borderwidth/2) );
	LineTo( hdcbuffer, xmax-((int)(borderwidth/2)), ymax-((int)(borderwidth/2)) );
	LineTo( hdcbuffer, (int)(borderwidth/2), ymax-((int)(borderwidth/2)) );
	LineTo( hdcbuffer, (int)(borderwidth/2), (int)(borderwidth/2) );
	DeleteObject(black_pen);

	/*Zeichnen der Löcher*/
	SelectObject(hdcbuffer, black_brush);

	/*Oben links*/
	Ellipse( hdcbuffer, (int)(borderwidth/5), (int)(borderwidth/5), (int)(borderwidth*1.5), (int)(borderwidth*1.5) );

	/*Oben rechts*/
	Ellipse( hdcbuffer, (xmax - (int)(borderwidth*1.5)), (int)(borderwidth/5), xmax -((int)(borderwidth/5)) , (int)(borderwidth*1.5) );

	/*Unten rechts*/
	Ellipse( hdcbuffer, (xmax - (int)(borderwidth*1.5)), (ymax - (int)(borderwidth*1.5)), xmax -((int)(borderwidth/5)) , ymax - ((int)(borderwidth/5)) );

	/*Unten links*/
	Ellipse( hdcbuffer, (int)(borderwidth/5), (ymax - (int)(borderwidth*1.5)), (int)(borderwidth*1.5), ymax - ((int)(borderwidth/5)) );

	/*Jetzt noch die zwei Löcher in der Mitte*/
	/*Obere Mitte*/
	Ellipse( hdcbuffer, (int)((xmax/2)-(borderwidth/2)), (int)(borderwidth/5),(int)((xmax/2)+borderwidth), (int)(borderwidth*1.5) );

	/*Untere Mitte*/
	Ellipse( hdcbuffer, (int)((xmax/2)-(borderwidth/2)), (ymax - (int)(borderwidth*1.5)),(int)((xmax/2)+borderwidth), ymax - ((int)(borderwidth/5)) );

	/*Von Buffer auf Vordergrund flipen*/
	BitBlt(hdc, 0, 0, xmax, ymax, hdcbuffer, 0, 0, SRCCOPY);

	DeleteDC(hdcbuffer);
}

LRESULT CALLBACK WindowProc(HWND hwnd, UINT m, WPARAM wParam, LPARAM lParam)
{
  // Fenster auf
  switch ( m )
  {
		case WM_CREATE: //SetTimer(hwnd, 0, dt, 0);
						//init(hwnd);
                        break;

		case WM_PAINT:  init(hwnd);
						break;

		case WM_TIMER:  break;

		case WM_MOVE:
		case WM_SIZE:   //init(hwnd);
						break;

        case WM_DESTROY: KillTimer(hdc, 0);
                         PostQuitMessage(0);
                         break;

		case WM_KEYDOWN:
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDOWN:
                                break;

        default: return DefWindowProc(hwnd, m, wParam, lParam);

  }

  return 0;
}
</code></pre>
<p>In dem FAQ Beitrag <a href="http://www.c-plusplus.net/forum/viewtopic.php?t=14713" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic.php?t=14713</a> ist mir eines nicht so ganz klar geworden. Die vorgehensweise ist doch folgende?: Ich führe alle zeichenoperationen auf dem Buffer durch und wenn ich dann fertig bin, tausche ich den Hintergrundbuffer mit dem Vordergrund aus, oder?</p>
<p>Wofür ist denn dann dieses :</p>
<pre><code>HBITMAP hBM = CreateCompatibleBitmap(hDC, cxClient, cyClient);
SelectObject(hDC2, hBM);
</code></pre>
<p>gut?<br />
Damit mache ich doch ein Bild von der aktuellen Oberfläche und zeichne sie in den Hintergrundbuffer.<br />
Wenn ich das mit einbaue dann sehe ich zwar alles wie gewünscht, jedoch ist das flackern um so stärker...</p>
<p>Wo liegt mein Denkfehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/669406</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/669406</guid><dc:creator><![CDATA[API Anfänger]]></dc:creator><pubDate>Thu, 09 Dec 2004 11:44:17 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit HIWORD und LOWORD on Thu, 09 Dec 2004 13:11:12 GMT]]></title><description><![CDATA[<p>API Anfänger schrieb:</p>
<blockquote>
<p>Wofür ist denn dann dieses :</p>
<pre><code>HBITMAP hBM = CreateCompatibleBitmap(hDC, cxClient, cyClient);
SelectObject(hDC2, hBM);
</code></pre>
</blockquote>
<p>Das ist das wichtigste(, das du einfach weggelassen hast). Es legt nämlich ein Bitmap (Größe: cxClient * cyClient) im Spiecher an und selektiert es in einen Gerätekontext (standardmassig ist hier ein monochromes 1*1 Bitmap drin), so werden alle Zeichenaktionen mittels diesem Gerätekontext in das Bitmap gezeichnet. (Das Bitmap muss wieder gelöscht werden, wenn es gemalt nicht mehr gebracuht wird!)</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /> In WM_PAINT ruft man BeginPaint und EndPaint auf, statt GetDC und ReleaseDC <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
<p>Um das flackern ganz weg zu kriegen verarbeitest du WM_ERASEBKGND und gibst dort einfach 0 zurück, da du ja sowieso den ganzen Klientbereich in WM_PAINT übermalst.</p>
<p>//In WM_SIZE solltest du das Fenster nicht neu malen, sondern im sagen, das es sioch neu malen soll, das geht z.B. mit Invalidatect(hwnd, 0, false);<br />
//ist bei dir ja noch auskommetiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/669495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/669495</guid><dc:creator><![CDATA[D*niel *chumann]]></dc:creator><pubDate>Thu, 09 Dec 2004 13:11:12 GMT</pubDate></item></channel></rss>