i dont understand these code!

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     static BOOL    bCapturing, bBlocking ;
     static HBITMAP hBitmap ;
     static HWND    hwndScr ;
     static POINT   ptBeg, ptEnd ;
     BITMAP         bm ;
     HBITMAP        hBitmapClip ;
     HDC            hdc, hdcMem ;
     int            iEnable ;
     PAINTSTRUCT    ps ;
     RECT           rect ;

     switch (message)
                    if(LockWindowUpdate(hwndScr =GetDesktopWindow()))
                          bCapturing  =TRUE;
          return 0 ;

                   bBlocking =TRUE;
                   ptBeg.x =LOWORD(lParam);
                   ptBeg.y =HIWORD(lParam);
                   ptEnd =ptBeg;

             return 0 ;

     case WM_MOUSEMOVE:
          if (bBlocking)
               ptEnd.x = LOWORD (lParam) ;
               ptEnd.y = HIWORD (lParam) ;
          return 0 ;

     case WM_LBUTTONUP:
     case WM_RBUTTONUP:
                    ptEnd.x =LOWORD(lParam);
                    ptEnd.y =HIWORD(lParam);

                          hBitmap =NULL;
                    hdc =GetDC(hwnd);
                    hdcMem =CreateCompatibleDC(hdc);
                    hBitmap =CreateCompatibleBitmap(hdc,abs(ptEnd.x -ptBeg.x),//?????attation: hdc belong to hwnd,but why create a bitmap about screen
                                                                          abs(ptEnd.y -ptBeg.y));
                    StretchBlt(hdcMem,0,0,abs(ptEnd.x -ptBeg.x),abs(ptEnd.y -ptBeg.y),
                           hdc,ptBeg.x,ptBeg.y,ptEnd.x -ptBeg.x,ptEnd.y-ptBeg.y,SRCCOPY);

              if(bBlocking || bCapturing)
                    bBlocking =bCapturing =FALSE;

          return 0 ;

     case WM_PAINT:
          hdc = BeginPaint (hwnd, &ps) ;

          if (hBitmap)
               GetClientRect (hwnd, &rect) ;

               hdcMem = CreateCompatibleDC (hdc) ;
               SelectObject (hdcMem, hBitmap) ;
               GetObject (hBitmap, sizeof (BITMAP), (PSTR) &bm) ;
               SetStretchBltMode (hdc, COLORONCOLOR) ;

               StretchBlt (hdc,    0, 0, rect.right, rect.bottom,
                           hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY) ;

               DeleteDC (hdcMem) ;
          EndPaint (hwnd, &ps) ;
          return 0 ;

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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
What is the question?
fyf7262284Author Commented:
question is inside the program!the place with "????" mark :
hBitmap =CreateCompatibleBitmap(hdc,abs(ptEnd.x -ptBeg.xabs(ptEnd.y -ptBeg.y));),
//?????attation: hdc belong to hwnd,but why create a bitmap about screen
It looks like VNC code ;-)
As far as I understand there is supposed that the window
received WM _ RBUTTONUP or WM _ LBUTTONUP is foreground.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.