}
-wxRect wxPrinterDCImpl::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect() const
{
if (!IsOk()) return wxRect(0, 0, 0, 0);
}
- HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetDevMode();
+ GlobalPtrLock lockDevMode;
+ const HGLOBAL devMode = data->GetDevMode();
+ if ( devMode )
+ lockDevMode.Init(devMode);
- DEVMODE *lpDevMode = hDevMode ? (DEVMODE *)::GlobalLock(hDevMode) : NULL;
-
- HDC hDC = ::CreateDC(NULL, deviceName.wx_str(), NULL, lpDevMode);
+ HDC hDC = ::CreateDC
+ (
+ NULL, // no driver name as we use device name
+ deviceName.wx_str(),
+ NULL, // unused
+ static_cast<DEVMODE *>(lockDevMode.Get())
+ );
if ( !hDC )
wxLogLastError(_T("CreateDC(printer)"));
- if ( lpDevMode )
- ::GlobalUnlock(hDevMode);
-
return (WXHDC) hDC;
#endif // PostScript/Windows printing
}
wxCoord width, wxCoord height,
wxDC *source,
wxCoord WXUNUSED(xsrc), wxCoord WXUNUSED(ysrc),
- int WXUNUSED(rop), bool useMask,
+ wxRasterOperationMode WXUNUSED(rop), bool useMask,
wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask))
{
wxDCImpl *impl = source->GetImpl();