views:

141

answers:

0

Scenario:

Screen capturing on multi display machines.

Capture screen of secondary monitor [which is the only affected]

Turn off Aero:

DwmEnableComposition(DWM\_EC_DISABLECOMPOSITION)

Create a [new] DC for the secondary monitor via:

m_DC->CreateDC(_T("DISPLAY"), _T("\\.\DISPALY2", NULL, NULL);

Result:

The DC will get an offset which "points" to the wrong part of the virtual display

CPoint DCOffset;

BOOL ok = ::GetDCOrgEx( hDC, &DCOffset );

where DCOffset.x and .y will be != 0

Remarks:

This behavior doesn't happen on Vista

If there is a delay between Aero Off and DC creation it may happen that the DC is correct for a while [== no Offset] but if windows are moved or their z-order is changed the DC will get the offset. Workaround: Create new DC when offset occurs.

affected graphic adapters: Intel GMA 4500 , Nvidia 9600GT