Solved

Changing the printer properties

Posted on 1999-01-17
1
470 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 …
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now