how to capture screen in a dual monitor system VC++

Visual Programming

Use the SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN as the parameter for GetSystemMetrics function.

Ex:  GetSystemMetrics(SM_CXVIRTUALSCREEN);

A Virtual Screen a logical rectangle which will wrap across all the monitors present for a desktop.  The SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN returns these logical x, y coordinates of the virtual screen.

We can use Dual Monitor API available for windows desktop development to get the details of each and every monitor individually.  The following piece of code will give the information about how to do it:

void ClipOrCenterRectToMonitor(LPRECT prc, UINT flags) { HMONITOR hMonitor; MONITORINFO mi; RECT rc; int w = prc->right - prc->left; int h = prc->bottom - prc->top; // // get the nearest monitor to the passed rect. // hMonitor = MonitorFromRect(prc, MONITOR_DEFAULTTONEAREST); // // get the work area or entire monitor rect. // mi.cbSize = sizeof(mi); GetMonitorInfo(hMonitor, &mi); if (flags & MONITOR_WORKAREA) rc = mi.rcWork; else rc = mi.rcMonitor; // // center or clip…

View original post 73 more words

About Khuram Ali

Programming... Programming and Programming...!!!

Posted on May 13, 2013, in C++, Windows Programming. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: