C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-10-2008, 12:37 PM   #1
Registered User
 
Join Date: Mar 2005
Posts: 15
Set Printer Prior To Loading Print Dialog Box

Hello,

In my application, the user selects the printer for the application on a menu screen. At print time I am loading a dialog box and want the previously selected printer to default into the dialog box (under the "Name:" field) as the printer but it is always being populated with the Windows Default Printer instead of the selected printer. Below is my code... any suggestions are appreciated. Thank you in advance for your help and time!


Code:
// PRINTER SELECTED BY USER IN BSTR, CSTRING, AND LPCTSTR FORM

CString str = g_csCustomPrinter;
LPCTSTR lpctstr  = g_csCustomPrinter;
BSTR bstr = str.AllocSysString();

// NEED SOMETHING HERE TO POPULATE DIALOG BOX WITH PRINTER
						
CPrintDialog cPrint(FALSE, PD_HIDEPRINTTOFILE | PD_NOPAGENUMS | PD_NOSELECTION, parent_view);
// THIS LOADS THE PRINT DIALOG BOX					
if(cPrint.DoModal() == IDOK)
{
     //EXECUTE SOME CODE
}

Last edited by Beaner; 10-10-2008 at 12:49 PM.
Beaner is offline   Reply With Quote
Old 10-10-2008, 12:41 PM   #2
Banned
 
master5001's Avatar
 
Join Date: Aug 2001
Location: Visalia, CA, USA
Posts: 3,699
Post more code. And put MFC questions on the Windows board next time. What specifically do you want to do? This?
master5001 is offline   Reply With Quote
Old 10-10-2008, 12:45 PM   #3
C++ Witch
 
laserlight's Avatar
 
Join Date: Oct 2003
Location: Singapore
Posts: 10,365
Quote:
And put MFC questions on the Windows board next time.
Yes... and moved!
__________________
C + C++ Compiler: MinGW port of GCC
Build + Version Control System: SCons + Bazaar

Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
laserlight is online now   Reply With Quote
Old 10-10-2008, 01:02 PM   #4
Registered User
 
Join Date: Mar 2005
Posts: 15
Sorry if I posted this in the wrong location. Thanks for your response... i apoligize if my first post was confusing maybe this will help:

g_csCustomPrinter is a global variable that was captured in another .cpp file... it is the one i want defaulted when the print dialog box is loaded

The orange line is where i am setting options on the print dialog box to "greyed out" so the user cannot change the selections of these items.

cPrint.DoModal() opens the print dialog box so the user can select printing objects and once OK is clicked on the print dialog box it will execute the //EXECUTE SOME CODE

What i want to do is take the printer selected by the user earlier that is stored in g_csCustomPrinter and set it in the red or orange section so when it gets to cPrint.DoModal() to open the print dialog box it will have the printer selected by the user default instead of the Windows Default Printer

The Print Dialog Box I am trying to populate is much like the print box you get when you use Internet Explorer and select Print... In Internet explorer you will have a list of your available printers available in the Select Printer area with the default one to be used highlighted in blue.... this is similar to what i am doing... in my dialog box it is highlighting the Windows Default Printer in blue (selected) instead of the one the user selects in my application g_csCustomPrinter ... i want the printer saved in the g_csCustomerPrinter to be selected when the dialog box is loaded...

i hope this clears things up instead of making it more confusing... thanks very much for your time.
Beaner is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
generic printing preferences dialog box stanlvw Windows Programming 8 06-27-2008 02:20 AM
dialog box problem keeps haunting me Bleech Windows Programming 2 08-23-2006 01:12 AM
validate data in a dialog box COBOL2C++ Windows Programming 4 09-22-2003 01:55 PM
Dialog Box Resources Mecnels Windows Programming 2 04-28-2003 05:57 AM
How to set paper size for the default printer through a program? Sugunan Windows Programming 5 09-03-2001 09:45 PM


All times are GMT -6. The time now is 08:05 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22