Solved

Changing the printer properties

Posted on 1999-01-17
1
477 Views
Last Modified: 2013-11-20
How can i change the default printer paper orientation to landscape or portrait?
I need to develope an active-x control through which i want to change the printer properties depending on the page on which the control is loaded.  I've seen some functions like setPrinter, setPrinterData.  But is there a simple way of doing this?
A piece of example code is greatly appreciated.
Thanx in advance
0
Comment
Question by:dloads
1 Comment
 

Accepted Solution

by:
fred2fred earned 100 total points
ID: 1327833
Here is an example method I wrote to do this.

BOOL CMyPrint::FullDlg(BOOL landscp, BOOL select, CWnd* pwnd, BOOL setfont)
{
    DEVMODE *dm;
    DWORD mode;
    m_poldfont = 0;

    mode = PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_USEDEVMODECOPIES |
            PD_RETURNDC | ((select) ? PD_SELECTION : PD_NOSELECTION);
    m_ppdlg = new CPrintDialog(FALSE, mode, pwnd);

    if (m_ppdlg->GetDefaults()) {
        dm = m_ppdlg->GetDevMode();
        dm->dmOrientation = (landscp) ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT;
        m_ppdlg->m_pd.Flags &= ~PD_RETURNDEFAULT;
    }

    if (m_ppdlg->DoModal() == IDOK) {
        JobSetup(setfont);
        return TRUE;
    }
    delete m_ppdlg;
    return FALSE;
}

NOTE: m_ppdlg is a CPrintDialog* in my CMyPrint class.


0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 95
ODBC Connection Logging, ADO.NET 6 64
iSeries DB2 Query 2 95
Doc'in system (example?) BA 7 107
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question