?
Solved

Changing the printer properties

Posted on 1999-01-17
1
Medium Priority
?
495 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month15 days, 14 hours left to enroll

850 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