<?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[malen]]></title><description><![CDATA[<p>Hallo ich habe ein problem -</p>
<p>wie ghet das das ich in ein Fenster SELBER malen kann</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/210026/malen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Apr 2026 04:54:41 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/210026.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 06 Apr 2008 12:00:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to malen on Sun, 06 Apr 2008 12:00:42 GMT]]></title><description><![CDATA[<p>Hallo ich habe ein problem -</p>
<p>wie ghet das das ich in ein Fenster SELBER malen kann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1487342</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1487342</guid><dc:creator><![CDATA[malmax]]></dc:creator><pubDate>Sun, 06 Apr 2008 12:00:42 GMT</pubDate></item><item><title><![CDATA[Reply to malen on Sun, 06 Apr 2008 12:20:26 GMT]]></title><description><![CDATA[<p>so du malermeister <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="😉"
    /></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg,
                          WPARAM wParam, LPARAM lParam );

LPCSTR MainClassName = &quot;Zeichnen&quot;;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
{
    WNDCLASSEX wc;
    MSG wmsg;
    HWND hWnd;

    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(GetModuleHandle(NULL), IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_CROSS);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = MainClassName;
    wc.lpszClassName = MainClassName;
    wc.hIconSm       = LoadIcon(GetModuleHandle(NULL), IDI_APPLICATION);

    if(!RegisterClassEx(&amp;wc))
    {
        MessageBox(NULL, &quot;Windows Registrations Fehler&quot;, &quot;Error!&quot;,
                   MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, MainClassName,
                          &quot;Gerätekontext Beispiel&quot;,
                          WS_SYSMENU | WS_VISIBLE,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          400, 300, NULL, NULL, hInstance, NULL);

    if(hWnd == NULL)
    {
        if(MessageBox(NULL, &quot;Fehler beim Erstellen des Fensters!&quot;,
                      &quot;Error!&quot;, MB_ICONEXCLAMATION | MB_OK) == IDOK)
            return 0;
    }

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

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg,
                          WPARAM wParam, LPARAM lParam )
{
    static int x1=-1,y1=-1,x2=-1,y2=-1;
    HDC hdc;
    PAINTSTRUCT ps;
    HPEN pen = CreatePen( PS_SOLID, 4, RGB(255, 0, 0 ));

    switch (uMsg)
    {
        case WM_PAINT :
            hdc=BeginPaint(hWnd, &amp;ps);
            SelectObject(hdc, pen);
            MoveToEx(hdc,x1,y1, NULL);
            LineTo(hdc,x2,y2);
            DeleteObject(pen);
            EndPaint(hWnd, &amp;ps);
            return 0;
        case WM_MOUSEMOVE :
            x1=x2;  //für MoveToEx
            y1=y2;  //für MoveToEx
            x2=LOWORD(lParam); //neue x-Position
            y2=HIWORD(lParam); //neue y-Postion
            //nur Zeichnen, wenn linker Button gedrückt ist
            if(wParam &amp; MK_LBUTTON)
                InvalidateRect(hWnd, NULL, FALSE);
            return 0;
        //rechte Maustaste-&gt;Bildschirm löschen
        case WM_RBUTTONDOWN :
            x1=x2=y1=y2=-1;
            InvalidateRect(hWnd, NULL, TRUE);
            break;
        case WM_DESTROY :
            PostQuitMessage(0);
            break;

        default :
            return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
    }
    return( 0L );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1487350</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1487350</guid><dc:creator><![CDATA[dumm]]></dc:creator><pubDate>Sun, 06 Apr 2008 12:20:26 GMT</pubDate></item><item><title><![CDATA[Reply to malen on Sun, 06 Apr 2008 12:27:32 GMT]]></title><description><![CDATA[<p>Indem du ein Fenster öffnest und darin malst!!<br />
Dazu kannst du die WM_PAINT Message abfangen und mit BeginPaint / EndPaint und den GDI Funktionen z.B. FillRect, SetPixel, LineTo MoteTo(Ex) etc.. dann malst..</p>
<p>Beispiel (Window Procedure):</p>
<pre><code class="language-cpp">LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, LPARAM lParam, WPARAM wParam){
  switch(msg):
  case WM_PAINT:
  {
    PAINTSTRUCT ps;
    BeginPaint(hWnd, &amp;ps);
    PaintDesktop(ps.hdc);
    EndPaint(hWnd, &amp;ps);
  }break;
  default:
  {
    return DefWindowProc(hWnd, msg, lParam, wParam);
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1487352</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1487352</guid><dc:creator><![CDATA[AntworteMax]]></dc:creator><pubDate>Sun, 06 Apr 2008 12:27:32 GMT</pubDate></item><item><title><![CDATA[Reply to malen on Sun, 06 Apr 2008 15:23:15 GMT]]></title><description><![CDATA[<p>malmax schrieb:</p>
<blockquote>
<p>Hallo ich habe ein problem -<br />
wie ghet das das ich in ein Fenster SELBER malen kann</p>
</blockquote>
<p>Es gibt auch Edding Stifte, die auf Glas haften.<br />
Sogar in vielen bunten Farben. <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/1487436</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1487436</guid><dc:creator><![CDATA[Edding]]></dc:creator><pubDate>Sun, 06 Apr 2008 15:23:15 GMT</pubDate></item></channel></rss>