How I get the DriverName, PrinterName and PortName from the selected printer (hDC)? 
Author Message
 How I get the DriverName, PrinterName and PortName from the selected printer (hDC)?

Hy,

I use VB6 SP3 and the Printer-CommonDialog to get the Devicecontext (hDC)
with the 'cdlPDReturnDC' Flag. Now I want to set the DriverName, PrinterName
and PortName in the SelectPrinter-Methode from CrystalReports Version 7. But
I do not know how to get the DriverName, PrinterName and PortName from the
selected printer (to set the .PrinterDefault = true is not a possibility)?

Thanks, Steffen

------------------------------
Steffen Maurer
Wiesbaden, Germany



Tue, 22 Jan 2002 03:00:00 GMT  
 How I get the DriverName, PrinterName and PortName from the selected printer (hDC)?
Hi Seffen,

Using the VB's CommonDialog control the only way to get this info is to
set the PrinterDefault property to TRUE. This will make the printer
selected by the user to be the Default one and than you can get Port
Driver and Name from the Printer object.

If changing the default printer is not desirable you will have to call
the PrintDlg() API directly to display the Printer dialog instead of the
limitted VB's CommonControl control and then you can have the DEVMODE
structure containing all the printer's settings made by the user. Also
you could display the Printer Dialog initilized with data for any system
printer, not just the default one.

If you want code that implements the above e-mail me.

Regards,
               Stoil

Quote:

> Hy,

> I use VB6 SP3 and the Printer-CommonDialog to get the Devicecontext (hDC)
> with the 'cdlPDReturnDC' Flag. Now I want to set the DriverName, PrinterName
> and PortName in the SelectPrinter-Methode from CrystalReports Version 7. But
> I do not know how to get the DriverName, PrinterName and PortName from the
> selected printer (to set the .PrinterDefault = true is not a possibility)?

> Thanks, Steffen

> ------------------------------
> Steffen Maurer
> Wiesbaden, Germany




Tue, 22 Jan 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. retrieve selected printer's port, devicename and drivername

2. Change printername of default printer

3. Printer.DriverName

4. obtaining list of Printer DriverNames and DeviceNames

5. Printer DriverName on NT/95/98

6. Printer.DriverName under Win NT 40

7. Getting HD ID

8. WSDL Portname location bindings

9. Q: Printing report on non-default printer w/o user selecting printer

10. Macro that selects printer and prints doc also changes default printer

11. How to select a printer out of the printers collection

12. Q: Forcing Printer Paper bins / Getting List Per Printer

 

 
Powered by phpBB® Forum Software