SetDefaultPrinter Method

 

Description

 

Assigns a remote printer the role od Default Printer.

 

PowerBASIC Syntax

 

METHOD SetDefaultPrinter ( _

BYVAL bstrPrinterName AS STRING _

)

 

Arguments

 

bstrPrinterName

BSTR. The remote printer UNC's name.

 

Remarks

 

The SetDefaultPrinter method fails when using a DOS-based printer connection. You cannot use the SetDefaultPrinter method to determine the name of the current default printer.

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

DIM pWshNetwork AS IWshNetwork

DIM bstrLocalName AS STRING

DIM bstrRemoteName AS STRING

 

pWshNetwork = NEWCOM "WScript.Network"

bstrLocalName = UCODE$("LPT1")

bstrRemoteName = UCODE$("\\Server\Print1")

pWshNetwork.AddConnection(bstrLocalName, bstrRemoteName)

pWshNetwork.SetDefaultPrinter UCODE$("\\research\library1")

 

Valid XHTML 1.0 Transitional