<?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 DrawText(), keine Ausgabe]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>habe ein kleines Problem, das mich doch etwas festhält.</p>
<p>Folgender Code:</p>
<pre><code class="language-cpp">void DrawInitText()
{
	HDC         hdc ; 
    PAINTSTRUCT ps ; 
    RECT        rect ;

	hdc = BeginPaint (hWnd, &amp;ps) ; 

    GetClientRect (hWnd, &amp;rect) ; 

    DrawText (hdc, TEXT (&quot;Hello, World!&quot;), -1, &amp;rect, 
              DT_SINGLELINE | DT_CENTER | DT_VCENTER) ; 

    TextOut (hdc, 20, 20, L&quot;Ich bin ein Fenster.&quot;, 20); // device context, x, y, string, string-Länge 

    EndPaint (hWnd, &amp;ps) ; 
}
</code></pre>
<p>Leider bekomme ich keine Ausgabe, wenn ich diese Methode aufrufe. Wo ist mein Denkfehler?</p>
<p>Danke euch und Gruß</p>
<p>Toby</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/218466/probleme-mit-drawtext-keine-ausgabe</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 01:43:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/218466.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 Jul 2008 09:55:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit DrawText(), keine Ausgabe on Mon, 21 Jul 2008 09:55:11 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen,</p>
<p>habe ein kleines Problem, das mich doch etwas festhält.</p>
<p>Folgender Code:</p>
<pre><code class="language-cpp">void DrawInitText()
{
	HDC         hdc ; 
    PAINTSTRUCT ps ; 
    RECT        rect ;

	hdc = BeginPaint (hWnd, &amp;ps) ; 

    GetClientRect (hWnd, &amp;rect) ; 

    DrawText (hdc, TEXT (&quot;Hello, World!&quot;), -1, &amp;rect, 
              DT_SINGLELINE | DT_CENTER | DT_VCENTER) ; 

    TextOut (hdc, 20, 20, L&quot;Ich bin ein Fenster.&quot;, 20); // device context, x, y, string, string-Länge 

    EndPaint (hWnd, &amp;ps) ; 
}
</code></pre>
<p>Leider bekomme ich keine Ausgabe, wenn ich diese Methode aufrufe. Wo ist mein Denkfehler?</p>
<p>Danke euch und Gruß</p>
<p>Toby</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550790</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550790</guid><dc:creator><![CDATA[HilfeSuchender()]]></dc:creator><pubDate>Mon, 21 Jul 2008 09:55:11 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DrawText(), keine Ausgabe on Mon, 21 Jul 2008 10:27:50 GMT]]></title><description><![CDATA[<p>Ich denke das muss in WM_PAINT:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     static TCHAR szAppName[] = TEXT (&quot;HelloWin&quot;) ;
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;

     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = NULL ;
     wndclass.lpszClassName = szAppName ;

     if (!RegisterClass (&amp;wndclass))
     {    // UNICODE-Compilierung ist die einzige realistische Fehlermöglichkeit 
          MessageBox (NULL, TEXT (&quot;Programm arbeitet mit Unicode und setzt Windows NT voraus!&quot;), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }

      hwnd = CreateWindow (szAppName,                 // Name der Fensterklasse
                  TEXT (&quot;Das erste echte Programm&quot;),  // Fenstertitel
                  WS_OVERLAPPEDWINDOW,                // Fensterstil
                  CW_USEDEFAULT,                      // X-Position des Fensters
                  CW_USEDEFAULT,                      // Y-Position des Fensters
                  CW_USEDEFAULT,                      // Fensterbreite
                  CW_USEDEFAULT,                      // Fensterhöhe
                  NULL,                               // übergeordnetes Fenster
                  NULL,                               // Menü
                  hInstance,                          // Programm-Kopiezähler (Programm-ID)
                  NULL) ;                             // zusätzliche Parameter

     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;

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

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{

     switch (message)
     {
     case WM_CREATE:
          return 0 ;

     case WM_PAINT: // So funktioniert es bei mir
          HDC         hdc ;
          PAINTSTRUCT ps ;
          RECT        rect ;
          hdc = BeginPaint (hwnd, &amp;ps) ;
          GetClientRect (hwnd, &amp;rect) ;
          DrawText (hdc, TEXT (&quot;Hello, World!&quot;), -1, &amp;rect,
              DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
          TextOut (hdc, 20, 20, L&quot;Ich bin ein Fenster.&quot;, 20); // device context,               
          //x, y, string, string-Länge
          EndPaint (hwnd, &amp;ps) ; 
          return 0 ;

     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
</code></pre>
<p>EDIT: Wenn du es außerhalb von WM_PAINT machen willst, kannst du GetDC und ReleaseDC statt Begin und EndPaint verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550810</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550810</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jul 2008 10:27:50 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DrawText(), keine Ausgabe on Mon, 21 Jul 2008 10:38:31 GMT]]></title><description><![CDATA[<p>Danke, gut zu wissen, wofür GetDC and ReleaseDC gut sind und wofür WM_Paint gut ist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550819</guid><dc:creator><![CDATA[HilfeSuchender()]]></dc:creator><pubDate>Mon, 21 Jul 2008 10:38:31 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DrawText(), keine Ausgabe on Mon, 21 Jul 2008 14:48:10 GMT]]></title><description><![CDATA[<p>Hab das jetzt eingebaut.</p>
<p>Die DrawText Methode wird allerdings in gesonderter Klasse (als Singelton) aufgerufen. Habe jetzt mehrere Probleme:</p>
<p>1. Wie funktioniert Resizing? (bitte nicht immer &quot;von Hand&quot; alles neu zeichnen...)<br />
2. Wieso verschwindet der Text wenn ein anderes Fenster überlappt?<br />
3. Wie kann ich eine ScrollBar einbauen, wenn der Text am Ende des Fensters ist?</p>
<p>Danke nochmals für eure Hilfe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1551020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1551020</guid><dc:creator><![CDATA[HilfeSuchender()]]></dc:creator><pubDate>Mon, 21 Jul 2008 14:48:10 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DrawText(), keine Ausgabe on Mon, 21 Jul 2008 15:32:09 GMT]]></title><description><![CDATA[<p>Das Problem ist, dass wenn ein anderes Fenster über deines kommt oder wenn die Größe geändert wird usw. wird WM_PAINT aufgerufen (zum neuzeichnen). Aber deine Textausgabe ist ja nicht ihn WM_PAINT, von daher wird es auch nicht erneut gezeichnet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1551046</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1551046</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 21 Jul 2008 15:32:09 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit DrawText(), keine Ausgabe on Wed, 23 Jul 2008 09:54:47 GMT]]></title><description><![CDATA[<p>evt.steh ich auch auf dem Schlauch, aber wie setz ich dann Klassen in WM_Paint, die will ich ja von überall in meinem Code aus aufrufen können?</p>
<p>Danke und Gruß</p>
<p>Toby</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1552252</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552252</guid><dc:creator><![CDATA[HilfeSuchender()]]></dc:creator><pubDate>Wed, 23 Jul 2008 09:54:47 GMT</pubDate></item></channel></rss>