Don't set PAGESETUPDLG::hDevNames and hDevMode when using PSD_RETURNDEFAULT.
If the page setup dialog is used to retrieve the default information, hDevMode and hDevNames fields must not be set, otherwise PageSetupDlg() function simply fails because of incorrect parameters passed to it. Closes #13928. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
0e3b10c509
commit
fd76344ecc
@ -990,19 +990,21 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
|
||||
return false;
|
||||
|
||||
pd = new PAGESETUPDLG;
|
||||
pd->hDevMode = NULL;
|
||||
pd->hDevNames = NULL;
|
||||
m_pageDlg = (void *)pd;
|
||||
|
||||
// We must not set hDevMode and hDevNames when using PSD_RETURNDEFAULT,
|
||||
// otherwise the call to PageSetupDlg() would fail.
|
||||
if ( data.GetDefaultInfo() )
|
||||
{
|
||||
pd->hDevMode = NULL;
|
||||
pd->hDevNames = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pass the devmode data (created in m_printData.ConvertToNative)
|
||||
// to the PRINTDLG structure, since it'll
|
||||
// be needed when PrintDlg is called.
|
||||
|
||||
if (pd->hDevMode)
|
||||
{
|
||||
GlobalFree(pd->hDevMode);
|
||||
pd->hDevMode = NULL;
|
||||
}
|
||||
pd->hDevMode = (HGLOBAL) native_data->GetDevMode();
|
||||
native_data->SetDevMode(NULL);
|
||||
|
||||
@ -1013,15 +1015,9 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
|
||||
// to the PRINTDLG structure, since it'll
|
||||
// be needed when PrintDlg is called.
|
||||
|
||||
if (pd->hDevNames)
|
||||
{
|
||||
GlobalFree(pd->hDevNames);
|
||||
pd->hDevNames = NULL;
|
||||
}
|
||||
pd->hDevNames = (HGLOBAL) native_data->GetDevNames();
|
||||
native_data->SetDevNames(NULL);
|
||||
|
||||
// pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
|
||||
}
|
||||
|
||||
pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
|
||||
|
||||
@ -1066,17 +1062,6 @@ bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
|
||||
pd->hPageSetupTemplate = NULL;
|
||||
pd->lpPageSetupTemplateName = NULL;
|
||||
|
||||
/*
|
||||
if ( pd->hDevMode )
|
||||
{
|
||||
DEVMODE *devMode = (DEVMODE*) GlobalLock(pd->hDevMode);
|
||||
memset(devMode, 0, sizeof(DEVMODE));
|
||||
devMode->dmSize = sizeof(DEVMODE);
|
||||
devMode->dmOrientation = m_orientation;
|
||||
devMode->dmFields = DM_ORIENTATION;
|
||||
GlobalUnlock(pd->hDevMode);
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user