?
Solved

Changing the printer properties

Posted on 1999-01-17
1
Medium Priority
?
488 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

752 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