Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtPPVW question Collapse All
Subject Author Date
tera tera Apr 28, 2009 - 3:55 AM

Hello.


Will not the appointment of the paper be possible from a program?


Thanks

Technical Support Apr 28, 2009 - 12:20 PM

Sorry but it is not supported.

tera tera Apr 30, 2009 - 6:11 PM

Hello.


Cannot you set it by the following programs?

Is there a problem?


 CWinApp* pWinApp=AfxGetApp();

    // Get default printer settings.     PRINTDLG   pd;     pd.lStructSize = (DWORD) sizeof(PRINTDLG);     if ( ! pWinApp->GetPrinterDeviceDefaults(&pd) ){      return -1;     }

    // Lock memory handle.     DEVMODE FAR* pDevMode =     (DEVMODE FAR*)::GlobalLock( pd.hDevMode );     LPDEVNAMES lpDevNames;     LPTSTR lpszDriverName, lpszDeviceName, lpszPortName;     HANDLE hPrinter;

    if (pDevMode){    // Unlock memory handle.     lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);     lpszDriverName = (LPTSTR )lpDevNames + lpDevNames->wDriverOffset;     lpszDeviceName = (LPTSTR )lpDevNames + lpDevNames->wDeviceOffset;     lpszPortName   = (LPTSTR )lpDevNames + lpDevNames->wOutputOffset;

  ::OpenPrinter(lpszDeviceName, &hPrinter, NULL);

    if ( Check_Paper ( hPrinter , m_iSize ) == 0 ){    pDevMode->dmPaperSize = m_iSize;     }   if ( Check_PaperOrientation ( hPrinter , m_iOrient ) == 0 ){ pDevMode->dmOrientation = m_iOrient;   }

::DocumentProperties(NULL,hPrinter,lpszDeviceName,pDevMode,     pDevMode, DM_IN_BUFFER|DM_OUT_BUFFER);

// Sync the pDevMode. // See SDK help for DocumentProperties for more info. ::ClosePrinter(hPrinter); GlobalUnlock( pd.hDevNames ); GlobalUnlock( pd.hDevMode );     }

Technical Support May 2, 2009 - 12:50 PM

We are sorry but we cannot use this code because it works with ANSI/MBCS versions of MFC and does not work with Unicode MFC.