Dual-screen/Multi-display screenshots

Source: Internet
Author: User

The source code of the screenshot program is available everywhere on the Internet, but it basically does not support multiple monitors.
At one time, I thought it was very difficult to support multiple monitors.


(Demo http://download.csdn.net/detail/problc/3841959 contains multi-display support, window highlighting, cross amplification, etc)


In fact, the multi-display screenshots are not very different from the screenshots of the primary monitor, and even do not require calls such as EnumDisplayMonitors. It's just because the source code is available on the internet that we don't bother thinking about.
1. DC problems.
HScrDC = CreateDC (_ T ("DISPLAY"), NULL); // main DISPLAY DC
HScrDC =: GetDC (getshorttopwindow (); // multi-screen DC


2. Coordinate issues.
Use the VIRTUALSCREEN parameter to obtain coordinates.
GetSystemMetrics (SM_CXVIRTUALSCREEN );
GetSystemMetrics (SM_CYVIRTUALSCREEN );
GetSystemMetrics (SM_XVIRTUALSCREEN );
GetSystemMetrics (SM_YVIRTUALSCREEN );


Note that SM_XVIRTUALSCREEN and SM_YVIRTUALSCREEN can be negative values for multiple monitors.
Therefore, do not consider the boundary as (0, 0)-> (cx, cy) when processing multiple monitors ).
The coordinates of multiple monitors are (0, 0) in the upper left corner of the main screen ).

 

If you have the source code for a single monitor, you may wish to change the above several small places, you will find that multi-screen screenshots are actually very easy.

From the column of problc
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.