<?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[Zeichnen]]></title><description><![CDATA[<p>Ich will bei mit der linken mouse taste zeichnen an iner form. Den code habe ich mir von msdn geholt. Aber nicht geschieht!</p>
<p>Warum?</p>
<p>Danke</p>
<pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	HDC hdc;
	BOOL fDraw = FALSE; 
	POINT ptPrevious; 

	PAINTSTRUCT ps;
	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		case WM_LBUTTONDOWN: 
    fDraw = TRUE; 
    ptPrevious.x = LOWORD(lParam); 
    ptPrevious.y = HIWORD(lParam); 
    return 0L; 

case WM_LBUTTONUP: 
    if (fDraw) 
    { 
        hdc = GetDC(hWnd); 
        MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL); 
        LineTo(hdc, LOWORD(lParam), HIWORD(lParam)); 
        ReleaseDC(hWnd, hdc); 
    } 
    fDraw = FALSE; 
    return 0L; 

case WM_MOUSEMOVE: 
    if (fDraw) 
    { 
        hdc = GetDC(hWnd); 
        MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL); 
        LineTo(hdc, ptPrevious.x = LOWORD(lParam), 
          ptPrevious.y = HIWORD(lParam)); 
        ReleaseDC(hWnd, hdc); 
    } 
    return 0L; 

		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &amp;ps);
		// TODO: Add any drawing code here...
		EndPaint(hWnd, &amp;ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/184746/zeichnen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 21:41:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/184746.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Jun 2007 18:20:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeichnen on Mon, 18 Jun 2007 18:20:25 GMT]]></title><description><![CDATA[<p>Ich will bei mit der linken mouse taste zeichnen an iner form. Den code habe ich mir von msdn geholt. Aber nicht geschieht!</p>
<p>Warum?</p>
<p>Danke</p>
<pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	HDC hdc;
	BOOL fDraw = FALSE; 
	POINT ptPrevious; 

	PAINTSTRUCT ps;
	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_ABOUT:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		case WM_LBUTTONDOWN: 
    fDraw = TRUE; 
    ptPrevious.x = LOWORD(lParam); 
    ptPrevious.y = HIWORD(lParam); 
    return 0L; 

case WM_LBUTTONUP: 
    if (fDraw) 
    { 
        hdc = GetDC(hWnd); 
        MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL); 
        LineTo(hdc, LOWORD(lParam), HIWORD(lParam)); 
        ReleaseDC(hWnd, hdc); 
    } 
    fDraw = FALSE; 
    return 0L; 

case WM_MOUSEMOVE: 
    if (fDraw) 
    { 
        hdc = GetDC(hWnd); 
        MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL); 
        LineTo(hdc, ptPrevious.x = LOWORD(lParam), 
          ptPrevious.y = HIWORD(lParam)); 
        ReleaseDC(hWnd, hdc); 
    } 
    return 0L; 

		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &amp;ps);
		// TODO: Add any drawing code here...
		EndPaint(hWnd, &amp;ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1308617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1308617</guid><dc:creator><![CDATA[Brane]]></dc:creator><pubDate>Mon, 18 Jun 2007 18:20:25 GMT</pubDate></item><item><title><![CDATA[Reply to Zeichnen on Mon, 18 Jun 2007 18:21:28 GMT]]></title><description><![CDATA[<p>Nichts geschieht heisst das program startet aber keine linien erscheninen!</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1308618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1308618</guid><dc:creator><![CDATA[Brane]]></dc:creator><pubDate>Mon, 18 Jun 2007 18:21:28 GMT</pubDate></item><item><title><![CDATA[Reply to Zeichnen on Mon, 18 Jun 2007 18:41:16 GMT]]></title><description><![CDATA[<p>Hast versehentlich einen ganzen Block an die falsche Stelle gepastet.</p>
<p>&quot;case WM_LBUTTONDOWN&quot;, &quot;case WM_LBUTTONUP&quot; und &quot;case WM_MOUSEMOVE&quot; stecken in der &quot;switch (wmId)&quot; von &quot;case WM_COMMAND&quot;.</p>
<p>Sie sollten aber sein in der &quot;switch (message)&quot;.<br />
<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/1308624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1308624</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 18 Jun 2007 18:41:16 GMT</pubDate></item><item><title><![CDATA[Reply to Zeichnen on Mon, 18 Jun 2007 19:01:45 GMT]]></title><description><![CDATA[<p>Das habe ich auch gemerkt, aber erst nach dem posten!</p>
<p>Hab es jetzt veraendert, aber es nutzt nichts. Ich kenn mich da sehr schlect aus aber ist es moeglich das ich die farbe irgendwie aendern muss?</p>
<p>Danke</p>
<pre><code class="language-cpp">LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;
	BOOL fDraw = FALSE; 
	POINT ptPrevious; 

	switch (message)
	{
	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		// Parse the menu selections:
		switch (wmId)
		{
		case IDM_\1:
			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &amp;ps);
		// TODO: Add any drawing code here...
		EndPaint(hWnd, &amp;ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
		case WM_LBUTTONDOWN: 
    fDraw = TRUE; 
    ptPrevious.x = LOWORD(lParam); 
    ptPrevious.y = HIWORD(lParam); 
    return 0L; 

case WM_LBUTTONUP: 
    if (fDraw) 
    { 
        hdc = GetDC(hWnd); 
        MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL); 
        LineTo(hdc, LOWORD(lParam), HIWORD(lParam)); 
        ReleaseDC(hWnd, hdc); 
    } 
    fDraw = FALSE; 
    return 0L; 

case WM_MOUSEMOVE: 
    if (fDraw) 
    { 
        hdc = GetDC(hWnd); 
        MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL); 
        LineTo(hdc, ptPrevious.x = LOWORD(lParam), 
          ptPrevious.y = HIWORD(lParam)); 
        ReleaseDC(hWnd, hdc); 
    } 
    return 0L; 
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1308638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1308638</guid><dc:creator><![CDATA[Brane]]></dc:creator><pubDate>Mon, 18 Jun 2007 19:01:45 GMT</pubDate></item><item><title><![CDATA[Reply to Zeichnen on Mon, 18 Jun 2007 19:17:02 GMT]]></title><description><![CDATA[<p>&quot;fDraw&quot; und &quot;ptPrevious&quot; sollten entweder statisch oder global deklariert sein damit sie ihre Werte halten können wenn die &quot;WinProc&quot; verlassen wird.</p>
<p>Probier mal so :</p>
<pre><code class="language-cpp">// BOOL fDraw = FALSE; 
 static BOOL fDraw = FALSE; 
// POINT ptPrevious; 
 static POINT ptPrevious;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1308655</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1308655</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 18 Jun 2007 19:17:02 GMT</pubDate></item></channel></rss>