VB 3 & Changing Printers (API) 
Author Message
 VB 3 & Changing Printers (API)

Does anyone have the exact code that you would use to change printers via
API calls in VB3.  I need to be able to switch between 2 printers on the
fly, and haven't been able to find out the answer to this one yet.

Thanks in advance,

Brandon

===================================================
Brandon LaBonte
Computer Operator II
Academic Computing Services - Texas Tech University

"There are three kinds of people.  Those who can count, and those who can't."
                                                - Chuck Sommerville



Fri, 28 May 1999 03:00:00 GMT  
 VB 3 & Changing Printers (API)



Quote:

> Does anyone have the exact code that you would use to change printers via
> API calls in VB3.  I need to be able to switch between 2 printers on the
> fly, and haven't been able to find out the answer to this one yet.

I don't have actual code that does this, but you might be able to
accomplish this via
manipulating the WIN.INI file (with WriteProfileString, etc.):

Notice that WIN.INI has a section [PrinterPorts].  This lists all the
printers in use in
the form:

    <PrinterName1>=<DriverName1>,<PortName1>
    <PrinterName2>=<DriverName2>,<PortName2>
    ...
    <PrinterNameN>=<DriverNameN>,<PortNameN>

Also, the section [Windows] has one line:

    device=<PrinterName>,<DriverName>,<PortName>

You can select the printer you want from the list in PrinterPorts (probably
can't
do this w/API calls, will have to use VB file I/O on WIN.INI file), then
modify the
"device=" line in the [Windows] section.  This should change the default
printer.  

I haven't actually tried this except doing it by hand, and looking at the
default
printer setting in Print Manager, but it seems to work in that context.

If you go this route, let me know how it works!  I might want to do it
someday!



Sat, 29 May 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to change the printer driver for a defined printer in VB code

2. PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)

3. Changing Printers property reset printer to Windows default printer

4. API to change default printer

5. API Calls to Change the Default Printer

6. how to change printer papersize using win API?

7. HELP: Changing Printer Fonts via API

8. Changing default printer using API calls

9. HELP !!! - Changing Printer Orientation using API

10. Changing the default settings of a Printer using SetPrinter-API and PRINTER_INFO_2 structure

11. API for changing default printer settings

12. THE PrintDlg() API TO CHANGE DEFAULT PRINTER ?!???

 

 
Powered by phpBB® Forum Software