CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2000
    Posts
    305

    Printer DC from address

    Hi

    I have an application that does some printing. I used to use CPrinterDlg to get a printer's device context.

    Code:
    CPrintDialog    printDlg(FALSE);    
    
    if (printDlg.DoModal() == IDCANCEL)        
       return; 
    	
    CDC *pDC = CDC::FromHandle(printDlg.GetPrinterDC());
    // ...
    // print, etc, etc...
    The new version of my app, however, stores the printer's address (UNC) in an ini file, so i need to know how do i obtain a printer DC from it's UNC.
    Can anyone help me on this ?

    Thanks in advance
    Pedro

  2. #2
    igbrus is offline Elite Member Power Poster
    Join Date
    Aug 2000
    Location
    Los Angeles
    Posts
    4,658
    Use CreateDC

  3. #3
    Join Date
    Jun 2000
    Posts
    305
    Originally posted by igbrus
    Use CreateDC
    This is what MSDN says about CreateDC():

    Code:
    HDC CreateDC( 
    LPCTSTR lpszDriver, 
    LPCTSTR lpszDevice, 
    LPCTSTR lpszOutput, 
    CONST DEVMODE *lpInitData);
    How can i find out what's the driver's file name ?

    Thanks for the help
    Pedro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured