how to capture a part of the screen from second monitor
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: how to capture a part of the screen from second monitor

  1. #1
    Join Date
    May 2001
    Posts
    165

    how to capture a part of the screen from second monitor

    hello all,
    i made an app to save part of my screen to a jpeg... it works great on single monitor... but if i pass a rect thats not within the main monitor the image will be black... anyone know they easy way to get part of the screen on any monitor... thx...
    •SlimGradey•

  2. #2
    Join Date
    Jun 2006
    Location
    Chile
    Posts
    13

    Re: how to capture a part of the screen from second monitor

    So how do you get the second monitor screen ?
    Pumpobee is prolounced as mumbolee

  3. #3
    Join Date
    May 2001
    Posts
    165

    Re: how to capture a part of the screen from second monitor

    this the code i use to take snap shot of my screen and crop it to the rect i want.. then save as jpeg...
    works fine on single monitor... how can i change this to work on dual monitors...

    Code:
    	HDC WinDC;
    	HDC CopyDC;
    	HBITMAP hBitmap;
    	ULONG bWidth,bHeight;
    	WinDC = ::GetDC(NULL);
    	CopyDC = CreateCompatibleDC(WinDC);
    
    	bWidth =  GetDeviceCaps(WinDC, HORZRES);
    	bHeight = GetDeviceCaps(WinDC, VERTRES);
    
    	hBitmap = CreateCompatibleBitmap(WinDC,bWidth,bHeight);
    
    	SelectObject(CopyDC,hBitmap);
    
    	BitBlt(CopyDC,0,0,bWidth,bHeight,WinDC,0,0,SRCCOPY);
    
    	::ReleaseDC(NULL,WinDC);
    	DeleteDC(CopyDC);
    
    
    	HDC hSrc = CreateCompatibleDC(NULL);
    	SelectObject(hSrc,hBitmap);
    	HDC hNew = CreateCompatibleDC(hSrc);
    	HBITMAP hBmp = CreateCompatibleBitmap(hSrc,width,height);
    	HBITMAP hOld = (HBITMAP)SelectObject(hNew,hBmp);
    	BitBlt(hNew,0,0,width,height,hSrc,left,top, SRCCOPY);
    	SelectObject(hNew,hOld);
    
           //code to save jpeg here....
    
    	DeleteDC(hSrc);
    	DeleteDC(hNew);
    	DeleteObject(hOld);
    	DeleteObject(hBmp);
    	DeleteObject(hBitmap);
    •SlimGradey•

  4. #4
    Join Date
    May 2001
    Posts
    165

    Re: how to capture a part of the screen from second monitor

    i still need help with this...
    trying find way to get bitmap of the second monitor...
    and make it work in the code above...
    thx...
    •SlimGradey•

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center