Re: Change Default Printer Problem
- From: "Tommy" <tommychu@xxxxxxxxxxxxxxxxx>
- Date: Wed, 13 Apr 2005 14:50:14 +0800
Thanks. I tried your code but still get trouble. My program prints out 2
papers with different orientation in 2 printers respectively.
Once I click "Print" button. It will set the default printer for printing
landscape and then it change the default printer for printing Portrait. I
find that all documents "go" to the second printer. It's my scenario.
Thanks.
"Karl E. Peterson" <karl@xxxxxxxx> ¼¶¼g©ó¶l¥ó·s»D:%23MyJpi6PFHA.1932@xxxxxxxxxxxxxxxxxxxxxxx
> You might want to look at my code to set/retrieve the default printer
> (http://vb.mvps.org/samples/PrnInfo) to see if that overcomes the issues
> you're
> seeing. Not sure I fully understand the situation you're facing.
> --
> Working Without a .NET?
> http://classicvb.org/petition
>
>
> Tommy wrote:
>> I use following code to change default printer. I find ok to change
>> it. (I observe the "default" whether is set in OS manually) However,
>> I share one printer with 2 different name with different printing
>> properties. Then I print 2 separate documents to these 2 printers
>> respectively in one routine. I expect that it print first document in
>> first printer and print second document in second one. However, all
>> documents are printed second one.
>>
>> I found a fun scenario. If I open 2 printers queue on screen and
>> focus in one of the "queue" box. Try to print again. The documents
>> can be printed to correct printer. Besides, I don't open these 2
>> printer queue before printing. Once printing first document. I click
>> the printer icon in system tray. I found that it can print correctly.
>> It may not be the key point for the problem but I don't understand
>> what cause it fails. Thanks for your reading and reply.
>>
>>
>> Public Declare Function SetDefaultPrinter Lib "winspool.drv" _
>> Alias "SetDefaultPrinterA" _
>> (ByVal pszPrinter As String) As Long
>>
>> Public Declare Function SendNotifyMessage Lib "user32" _
>> Alias "SendNotifyMessageA" _
>> (ByVal hwnd As Long, _
>> ByVal msg As Long, _
>> ByVal wParam As Long, _
>> lParam As Any) As Long
>>
>> private Sub ChangePrinter()
>> SetDefaultPrinter \\server\shareprinter
>> Call SendNotifyMessage(HWND_BROADCAST, _
>> WM_WININICHANGE, _
>> 0, ByVal "windows")
>> End Sub
>
>
>
.
- Follow-Ups:
- Re: Change Default Printer Problem
- From: Karl E. Peterson
- Re: Change Default Printer Problem
- References:
- Change Default Printer Problem
- From: Tommy
- Re: Change Default Printer Problem
- From: Karl E. Peterson
- Change Default Printer Problem
- Prev by Date: Re: INI file
- Next by Date: missing sscrc.dll
- Previous by thread: Re: Change Default Printer Problem
- Next by thread: Re: Change Default Printer Problem
- Index(es):