RemovePrinterConnection Method

 

Description

 

Adds a remote MS-DOS based printer connection to your computer system.

 

PowerBASIC Syntax

 

METHOD RemovePrinterConnection ( _

BYVAL bstrName AS STRING, _

OPTIONAL BYREF vForce AS VARIANT, _

OPTIONAL BYREF vUpdateProfile AS VARIANT, _

)

 

Arguments

 

bstrName

BSTR. String value indicating the name that identifies the printer. It can be a UNC name (in the form \\xxx\yyy) or a local name (such as LPT1).

vForce

Optional. VARIANT. Boolean value indicating whether to force the removal of the mapped printer. If set to true (the default is false), the printer connection is removed whether or not a user is connected.

vUpdateProfile

Optional. VARIANT. Boolean value. If set to true (the default is false), the change is saved in the user's profile.

 
Remarks

 

The RemovePrinterConnection method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method AddPrinterConnection, bstrName must be the printer's local name. If the printer was connected using the AddWindowsPrinterConnection method or was added manually (using the Add Printer wizard), then bstrName must be the printer's UNC name.

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

DIM pWshNetwork AS IWshNetwork

DIM bstrLocalName AS STRING

DIM bstrRemoteName AS STRING

 

pWshNetwork = NEWCOM "WScript.Network"

pWshNetwork.RemovePrinterConnection UCODE$("\\printserv\DefaultPrinter"), %VARIANT_TRUE, %VARIANT_TRUE

 

Valid XHTML 1.0 Transitional