Thread: Set Printer Prior To Loading Print Dialog Box

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 02:20 AM
  2. dialog box problem keeps haunting me
    By Bleech in forum Windows Programming
    Replies: 2
    Last Post: 08-23-2006, 01:12 AM
  3. validate data in a dialog box
    By COBOL2C++ in forum Windows Programming
    Replies: 4
    Last Post: 09-22-2003, 01:55 PM
  4. Dialog Box Resources
    By Mecnels in forum Windows Programming
    Replies: 2
    Last Post: 04-28-2003, 05:57 AM
  5. Replies: 5
    Last Post: 09-03-2001, 09:45 PM