<?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 double buffer, bitte um kommentar]]></title><description><![CDATA[<p>Moins,<br />
vor einiger zeit hatte ich schon mal ein ähnliches problem beschrieben, hier habe ich aber mal konkreten source.</p>
<p>Erstmal zum source:<br />
Es wird ein fenster mit drei TrackBar's erstellt, die TrackBars können werte zwischen 0-255 annhemne und repräsentieren Farbwerte in RGB. Links neben jeder TrackBar wird ein RoundRect mit der Jeweiligen Farbe und einen hellblauen Rahmen gezeichnet.</p>
<p>Jetzt zum Bug:</p>
<p>Scrollt man mit der Maus die TrackBars (mal verschiedene, mal reicht eine) sehr schnell hin und her, so kommt es nach einiger zeit reproduzierbar dazu, das der double buffering bereich Weiß gezeichnet wird, die Rahmen der RoundRect Schwarz. Der zustand verbleibt bis zum neustart des Programms.</p>
<p>In einem anderen ähnlichen Fall kam es sogar dazu das die Captionbar des Windows beim Vergrößern sich nicht neu gezeichnet hat.</p>
<p>Leider weiß ich mal <strong>überhaut nicht</strong> woran das liegen könnte.</p>
<p>Ich werde hier den kompletten source einfügen:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;commctrl.h&gt;
/*  Declare Windows procedure  */
HINSTANCE hGlobalInstance;
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = &quot;WindowsApp&quot;;

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&amp;wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;Windows App&quot;,       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);
hGlobalInstance=hThisInstance;
    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   static HWND hTrackRed;
static HWND hTrackGreen;
static HWND hTrackBlue;

static HWND hChildRed;
static HWND hChildGreen;
static HWND hChildBlue;

UINT iMin=0;
UINT iMax=255;
UINT iSelMin=0;
UINT iSelMax=255;

switch(message)
 { case WM_CREATE:
          {    
                //system(&quot;pause&quot;);   

           /*
           ostringstream res;
           res&lt;&lt;*(This-&gt;lpCol);
           MessageBox(hWnd,res.str().c_str(), &quot;About...&quot;, MB_OK | MB_ICONINFORMATION);
           */
           InitCommonControls(); // loads common control's DLL 

hTrackRed = CreateWindowEx(0,
TRACKBAR_CLASS,
&quot;Red&quot;,
WS_CHILD | WS_VISIBLE |
TBS_ENABLESELRANGE | TBS_NOTICKS,
20, 10,
200, 20,
hWnd,
NULL,
hGlobalInstance,
NULL);
hTrackGreen = CreateWindowEx(0,
TRACKBAR_CLASS,
&quot;Green&quot;,
WS_CHILD | WS_VISIBLE |
TBS_ENABLESELRANGE | TBS_NOTICKS,
20, 35,
200, 20,
hWnd,
NULL,
hGlobalInstance,
NULL);
hTrackBlue = CreateWindowEx(0,
TRACKBAR_CLASS,
&quot;Blue&quot;,
WS_CHILD | WS_VISIBLE |
TBS_ENABLESELRANGE | TBS_NOTICKS,
20, 60,
200, 20,
hWnd,
NULL,
hGlobalInstance,
NULL);

    SendMessage(hTrackRed, TBM_SETRANGE, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) MAKELONG(iMin, iMax));  // min. &amp; max. positions 
    SendMessage(hTrackRed, TBM_SETPAGESIZE, 
        0, (LPARAM) 4);                  // new page size 

    SendMessage(hTrackRed, TBM_SETSEL, 
        (WPARAM) FALSE,                  // redraw flag 
        (LPARAM) MAKELONG(iSelMin, iSelMax)); 

    SendMessage(hTrackGreen, TBM_SETRANGE, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) MAKELONG(iMin, iMax));  // min. &amp; max. positions 
    SendMessage(hTrackGreen, TBM_SETPAGESIZE, 
        0, (LPARAM) 4);                  // new page size 

    SendMessage(hTrackGreen, TBM_SETSEL, 
        (WPARAM) FALSE,                  // redraw flag 
        (LPARAM) MAKELONG(iSelMin, iSelMax)); 
    SendMessage(hTrackBlue, TBM_SETRANGE, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) MAKELONG(iMin, iMax));  // min. &amp; max. positions 
    SendMessage(hTrackBlue, TBM_SETPAGESIZE, 
        0, (LPARAM) 4);                  // new page size 

    SendMessage(hTrackBlue, TBM_SETSEL, 
        (WPARAM) FALSE,                  // redraw flag 
        (LPARAM) MAKELONG(iSelMin, iSelMax)); 

    //ShowWindow(
    //SetFocus(hwndTrack); 

    /*
    ostringstream res;
           res&lt;&lt;tempCol;
           MessageBox(hWnd,res.str().c_str(), &quot;About...&quot;, MB_OK | MB_ICONINFORMATION);
      */     

    int tempCol=0x00ff3a56;
    SendMessage(hTrackRed, TBM_SETPOS, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) GetRValue(tempCol)); 
    SendMessage(hTrackGreen, TBM_SETPOS, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) GetGValue(tempCol)); 
        SendMessage(hTrackBlue, TBM_SETPOS, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) GetBValue(tempCol));     

           return  DefWindowProc(hWnd,message,wParam,lParam);

          }
        case WM_PAINT:
             {
             RECT rect;
             GetWindowRect(hWnd,&amp;rect);

             int width=rect.right-rect.left;
             int height=rect.bottom-rect.top;         

             int bkgCol=0x00d8e9ec;
             int frmCol=0x00b99d7f; 
             COLORREF RedCol=RGB(SendMessage(hTrackRed,TBM_GETPOS,(WPARAM)NULL,(LPARAM)NULL),0,0);
             COLORREF GreenCol=RGB(0,SendMessage(hTrackGreen,TBM_GETPOS,(WPARAM)NULL,(LPARAM)NULL),0);
             COLORREF BlueCol=RGB(0,0,SendMessage(hTrackBlue,TBM_GETPOS,(WPARAM)NULL,(LPARAM)NULL));
             PAINTSTRUCT ps;
             HDC hDC=BeginPaint(hWnd,&amp;ps); 
             HDC hMemDC=CreateCompatibleDC(hDC);
             HBITMAP hBm = CreateCompatibleBitmap(hDC, width+1, height+1); 
             SelectObject(hMemDC, hBm);                           
               //Draw background
             HBRUSH hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(bkgCol));
             HPEN hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,bkgCol));
             RoundRect(hMemDC,0,0,400+1,200+1+1,0,0);
             hOldBrush=(HBRUSH)SelectObject(hMemDC, CreateSolidBrush(bkgCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(PS_DOT,2,frmCol));

            // COLORREF MixedCol=RedCol|GreenCol|BlueCol;
             hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(RedCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,frmCol));
             RoundRect(hMemDC,5,10,15,30,15,15);

             hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(GreenCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,frmCol));
             RoundRect(hMemDC,5,35,15,55,15,15);

             hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(BlueCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,frmCol));
             RoundRect(hMemDC,5,60,15,80,15,15);

             BitBlt(hDC, 0, 0, 400, 200, hMemDC, 0, 0, SRCCOPY); 
              DeleteDC(hMemDC);
              DeleteObject(hBm);
              DeleteObject(hOldBrush);
              DeleteObject(hOldPen); 
              EndPaint(hWnd,&amp;ps); 
              //DeleteDC(hDC);     

             return DefWindowProc (hWnd, message, wParam, lParam);
             }

          case WM_HSCROLL: {
               switch (LOWORD(wParam)) { 
                      case TB_ENDTRACK:{ 
                      DWORD dwPos = SendMessage(hTrackRed, TBM_GETPOS, 0, 0); 
                       if (dwPos &gt; iSelMax) 
                          SendMessage(hTrackRed, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMax); 
                       else if (dwPos &lt; iSelMin) 
                          SendMessage(hTrackRed, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMin); 
                       dwPos = SendMessage(hTrackGreen, TBM_GETPOS, 0, 0); 
                       if (dwPos &gt; iSelMax) 
                          SendMessage(hTrackGreen, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMax); 
                       else if (dwPos &lt; iSelMin) 
                          SendMessage(hTrackGreen, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMin); 
                       dwPos = SendMessage(hTrackBlue, TBM_GETPOS, 0, 0); 
                       if (dwPos &gt; iSelMax) 
                          SendMessage(hTrackBlue, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMax); 
                       else if (dwPos &lt; iSelMin) 
                          SendMessage(hTrackBlue, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMin); 

                          }
                          }

               RECT rect;
               GetWindowRect(hWnd,&amp;rect);
               InvalidateRect(hWnd,NULL,FALSE); 

               return 0;
               }
     case WM_ERASEBKGND: {return 1;}
          case WM_DESTROY:
            {//PostQuitMessage (0);       
            return 0;

          }
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hWnd, message, wParam, lParam);
    }

    return 0;    

};
</code></pre>
<p>Danke im Vorraus für eure meinung <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/topic/230856/problem-mit-double-buffer-bitte-um-kommentar</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 21:59:02 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/230856.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Jan 2009 02:59:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit double buffer, bitte um kommentar on Sat, 03 Jan 2009 02:59:40 GMT]]></title><description><![CDATA[<p>Moins,<br />
vor einiger zeit hatte ich schon mal ein ähnliches problem beschrieben, hier habe ich aber mal konkreten source.</p>
<p>Erstmal zum source:<br />
Es wird ein fenster mit drei TrackBar's erstellt, die TrackBars können werte zwischen 0-255 annhemne und repräsentieren Farbwerte in RGB. Links neben jeder TrackBar wird ein RoundRect mit der Jeweiligen Farbe und einen hellblauen Rahmen gezeichnet.</p>
<p>Jetzt zum Bug:</p>
<p>Scrollt man mit der Maus die TrackBars (mal verschiedene, mal reicht eine) sehr schnell hin und her, so kommt es nach einiger zeit reproduzierbar dazu, das der double buffering bereich Weiß gezeichnet wird, die Rahmen der RoundRect Schwarz. Der zustand verbleibt bis zum neustart des Programms.</p>
<p>In einem anderen ähnlichen Fall kam es sogar dazu das die Captionbar des Windows beim Vergrößern sich nicht neu gezeichnet hat.</p>
<p>Leider weiß ich mal <strong>überhaut nicht</strong> woran das liegen könnte.</p>
<p>Ich werde hier den kompletten source einfügen:</p>
<pre><code>#include &lt;windows.h&gt;
#include &lt;commctrl.h&gt;
/*  Declare Windows procedure  */
HINSTANCE hGlobalInstance;
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = &quot;WindowsApp&quot;;

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&amp;wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           &quot;Windows App&quot;,       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);
hGlobalInstance=hThisInstance;
    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&amp;messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&amp;messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&amp;messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   static HWND hTrackRed;
static HWND hTrackGreen;
static HWND hTrackBlue;

static HWND hChildRed;
static HWND hChildGreen;
static HWND hChildBlue;

UINT iMin=0;
UINT iMax=255;
UINT iSelMin=0;
UINT iSelMax=255;

switch(message)
 { case WM_CREATE:
          {    
                //system(&quot;pause&quot;);   

           /*
           ostringstream res;
           res&lt;&lt;*(This-&gt;lpCol);
           MessageBox(hWnd,res.str().c_str(), &quot;About...&quot;, MB_OK | MB_ICONINFORMATION);
           */
           InitCommonControls(); // loads common control's DLL 

hTrackRed = CreateWindowEx(0,
TRACKBAR_CLASS,
&quot;Red&quot;,
WS_CHILD | WS_VISIBLE |
TBS_ENABLESELRANGE | TBS_NOTICKS,
20, 10,
200, 20,
hWnd,
NULL,
hGlobalInstance,
NULL);
hTrackGreen = CreateWindowEx(0,
TRACKBAR_CLASS,
&quot;Green&quot;,
WS_CHILD | WS_VISIBLE |
TBS_ENABLESELRANGE | TBS_NOTICKS,
20, 35,
200, 20,
hWnd,
NULL,
hGlobalInstance,
NULL);
hTrackBlue = CreateWindowEx(0,
TRACKBAR_CLASS,
&quot;Blue&quot;,
WS_CHILD | WS_VISIBLE |
TBS_ENABLESELRANGE | TBS_NOTICKS,
20, 60,
200, 20,
hWnd,
NULL,
hGlobalInstance,
NULL);

    SendMessage(hTrackRed, TBM_SETRANGE, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) MAKELONG(iMin, iMax));  // min. &amp; max. positions 
    SendMessage(hTrackRed, TBM_SETPAGESIZE, 
        0, (LPARAM) 4);                  // new page size 

    SendMessage(hTrackRed, TBM_SETSEL, 
        (WPARAM) FALSE,                  // redraw flag 
        (LPARAM) MAKELONG(iSelMin, iSelMax)); 

    SendMessage(hTrackGreen, TBM_SETRANGE, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) MAKELONG(iMin, iMax));  // min. &amp; max. positions 
    SendMessage(hTrackGreen, TBM_SETPAGESIZE, 
        0, (LPARAM) 4);                  // new page size 

    SendMessage(hTrackGreen, TBM_SETSEL, 
        (WPARAM) FALSE,                  // redraw flag 
        (LPARAM) MAKELONG(iSelMin, iSelMax)); 
    SendMessage(hTrackBlue, TBM_SETRANGE, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) MAKELONG(iMin, iMax));  // min. &amp; max. positions 
    SendMessage(hTrackBlue, TBM_SETPAGESIZE, 
        0, (LPARAM) 4);                  // new page size 

    SendMessage(hTrackBlue, TBM_SETSEL, 
        (WPARAM) FALSE,                  // redraw flag 
        (LPARAM) MAKELONG(iSelMin, iSelMax)); 

    //ShowWindow(
    //SetFocus(hwndTrack); 

    /*
    ostringstream res;
           res&lt;&lt;tempCol;
           MessageBox(hWnd,res.str().c_str(), &quot;About...&quot;, MB_OK | MB_ICONINFORMATION);
      */     

    int tempCol=0x00ff3a56;
    SendMessage(hTrackRed, TBM_SETPOS, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) GetRValue(tempCol)); 
    SendMessage(hTrackGreen, TBM_SETPOS, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) GetGValue(tempCol)); 
        SendMessage(hTrackBlue, TBM_SETPOS, 
        (WPARAM) TRUE,                   // redraw flag 
        (LPARAM) GetBValue(tempCol));     

           return  DefWindowProc(hWnd,message,wParam,lParam);

          }
        case WM_PAINT:
             {
             RECT rect;
             GetWindowRect(hWnd,&amp;rect);

             int width=rect.right-rect.left;
             int height=rect.bottom-rect.top;         

             int bkgCol=0x00d8e9ec;
             int frmCol=0x00b99d7f; 
             COLORREF RedCol=RGB(SendMessage(hTrackRed,TBM_GETPOS,(WPARAM)NULL,(LPARAM)NULL),0,0);
             COLORREF GreenCol=RGB(0,SendMessage(hTrackGreen,TBM_GETPOS,(WPARAM)NULL,(LPARAM)NULL),0);
             COLORREF BlueCol=RGB(0,0,SendMessage(hTrackBlue,TBM_GETPOS,(WPARAM)NULL,(LPARAM)NULL));
             PAINTSTRUCT ps;
             HDC hDC=BeginPaint(hWnd,&amp;ps); 
             HDC hMemDC=CreateCompatibleDC(hDC);
             HBITMAP hBm = CreateCompatibleBitmap(hDC, width+1, height+1); 
             SelectObject(hMemDC, hBm);                           
               //Draw background
             HBRUSH hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(bkgCol));
             HPEN hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,bkgCol));
             RoundRect(hMemDC,0,0,400+1,200+1+1,0,0);
             hOldBrush=(HBRUSH)SelectObject(hMemDC, CreateSolidBrush(bkgCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(PS_DOT,2,frmCol));

            // COLORREF MixedCol=RedCol|GreenCol|BlueCol;
             hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(RedCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,frmCol));
             RoundRect(hMemDC,5,10,15,30,15,15);

             hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(GreenCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,frmCol));
             RoundRect(hMemDC,5,35,15,55,15,15);

             hOldBrush = (HBRUSH)SelectObject(hMemDC,CreateSolidBrush(BlueCol));
             hOldPen=(HPEN)SelectObject(hMemDC,CreatePen(1,1,frmCol));
             RoundRect(hMemDC,5,60,15,80,15,15);

             BitBlt(hDC, 0, 0, 400, 200, hMemDC, 0, 0, SRCCOPY); 
              DeleteDC(hMemDC);
              DeleteObject(hBm);
              DeleteObject(hOldBrush);
              DeleteObject(hOldPen); 
              EndPaint(hWnd,&amp;ps); 
              //DeleteDC(hDC);     

             return DefWindowProc (hWnd, message, wParam, lParam);
             }

          case WM_HSCROLL: {
               switch (LOWORD(wParam)) { 
                      case TB_ENDTRACK:{ 
                      DWORD dwPos = SendMessage(hTrackRed, TBM_GETPOS, 0, 0); 
                       if (dwPos &gt; iSelMax) 
                          SendMessage(hTrackRed, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMax); 
                       else if (dwPos &lt; iSelMin) 
                          SendMessage(hTrackRed, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMin); 
                       dwPos = SendMessage(hTrackGreen, TBM_GETPOS, 0, 0); 
                       if (dwPos &gt; iSelMax) 
                          SendMessage(hTrackGreen, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMax); 
                       else if (dwPos &lt; iSelMin) 
                          SendMessage(hTrackGreen, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMin); 
                       dwPos = SendMessage(hTrackBlue, TBM_GETPOS, 0, 0); 
                       if (dwPos &gt; iSelMax) 
                          SendMessage(hTrackBlue, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMax); 
                       else if (dwPos &lt; iSelMin) 
                          SendMessage(hTrackBlue, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) iSelMin); 

                          }
                          }

               RECT rect;
               GetWindowRect(hWnd,&amp;rect);
               InvalidateRect(hWnd,NULL,FALSE); 

               return 0;
               }
     case WM_ERASEBKGND: {return 1;}
          case WM_DESTROY:
            {//PostQuitMessage (0);       
            return 0;

          }
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hWnd, message, wParam, lParam);
    }

    return 0;    

};
</code></pre>
<p>Danke im Vorraus für eure meinung <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/1638643</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638643</guid><dc:creator><![CDATA[zeusosc]]></dc:creator><pubDate>Sat, 03 Jan 2009 02:59:40 GMT</pubDate></item></channel></rss>