Solved

Changing the printer properties

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA "SendKeys" Syntax for Multiple Keystrokes 7 103
lucky13 challenge 11 125
canBalance challenge 34 70
wordmultiple challenge 12 121
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

862 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

25 Experts available now in Live!

Get 1:1 Help Now