detect if extended desktop is to the left or to the right
So, I have a screen capture utility (it takes full screen shots and saves it to png files) I've written, and it uses SM_CXVIRTUALSCREEN
and SM_CYVIRTUALSCREEN
to determine the width and height of the desktop.
I then get the desktop DC and copy out the bits and save them as png.
BitB开发者_如何学运维lt( backDC, 0, 0, backBufferCX, backBufferCX, desktopDC, X_SRC, 0, SRCCOPY );
Here X_SRC
is usually 0, UNLESS THE DESKTOP HAS BEEN EXTENDED "TO THE LEFT". In that case it needs to be -1280px, for example, if the left monitor measures 1280px.
How can I determine if the desktop's starting point is negative (if the user has extended his desktop to the left?)
You can obtain the positioning information for all of the monitors via the EnumDisplayMonitors method.
Or, if you only care about the corners of the virtual screen, you can pass SM_XVIRTUALSCREEN
and SM_YVIRTUALSCREEN
into the GetSystemMetrics
method.
You should use GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN)
as the x, y coordinates to BitBlt
精彩评论