Solved

Switching Paper Orientation Programmatically

Posted on 1997-06-29
4
312 Views
Last Modified: 2013-12-03
I need to be able to store the most recently used paper orientation from the last app session and restore it the next  time the program is run.  Storing it is no problem, but I can't work out how to do the switch.  

I'm using MFC 2.5 which handles all printer settings thorugh CPrintDlg (a wrapper for the PRINTDLG structure).  Any changes the user makes are hidden away inside the common print dialog procedure, so there's no clues there.  Simply modifying the DEVMODE structure (stored by CWinApp) causes system errors, so I assume the update must be done within a Windows function.

The solution needs to be compatible with the MFC 2.5 printing framework.  Any suggestions?  Thanks.
0
Comment
Question by:scce
[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
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
AVaulin earned 100 total points
ID: 1399587
Use CPrintDialog::CreatePrinterDC method to do what you want.
0
 

Author Comment

by:scce
ID: 1399588
I'm not sure what you mean, AVaulin.  How do I use the CreatePrinterDC function and then manipulate it to change settings?  Can you provide a little more detail?

Thanks.
0
 
LVL 4

Expert Comment

by:AVaulin
ID: 1399589
You said "Storing it is no problem". To restore you must use CreatePrinterDC method of CPrintDialog class. You must construct CPrintDialog object and call CreatePrinterDC method without calling DoModal function. Set all parameters you need in m_psd class member (it's PAGESETUPDLG public CCommonDialog class member and CPrintDialog is CCommonDialog son).
Good luck.
0
 

Author Comment

by:scce
ID: 1399590
Thanks, AVaulin.

I'm not sure if this will work for me though, because I am using MFC 2.5 (16-bit) - isn't CCommonDialog and PAGESETUPDLG new for 32-bit MFC?

Anyway I will try to find the equivalent fields for the PRINTDLG structure and use the CreatePrinterDC function as you suggested.

0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

728 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