In VC++ 5.0 I use the following code in order to set the printer in landscape mode:
//set landscape mode
DEVMODE FAR *lpDevMode = (DEVMODE FAR *) ::GlobalLock(PrintDialog.m_pd.hDevMode);
lpDevMode->dmOrientation = DMORIENT_LANDSCAPE;
if (PrintDialog.DoModal() == IDCANCEL)
After this I do the printing, and everything seems to work fine until I close the application. Then a debug assertion error in winutil.cpp (procedure AfxGlobalFree) occurs.
By commenting out parts I found that the problem lies in the GetPrinterDeviceDefaults. If this is not used there is no problem. I suppose something must be freed, cleared or something like that. Who can help me?