use GlobalPtrLock (modified to allow not initializing it if the ptr is NULL) in wxGetPrinterDC() to avoid /Wp64 warnings and also make code safer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52164 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -327,17 +327,21 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
wx_static_cast(DEVMODE *, lockDevMode.Get())
|
||||
);
|
||||
if ( !hDC )
|
||||
wxLogLastError(_T("CreateDC(printer)"));
|
||||
|
||||
if ( lpDevMode )
|
||||
::GlobalUnlock(hDevMode);
|
||||
|
||||
return (WXHDC) hDC;
|
||||
#endif // PostScript/Windows printing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user