AddPrinterConnection Method

 

Description

 

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

 

PowerBASIC Syntax

 

METHOD AddPrinterConnection ( _

BYVAL bstrLocalName AS STRING, _

BYVAL bstrRemoteName AS STRING, _

OPTIONAL BYREF vUpdateProfile AS VARIANT, _

OPTIONAL BYREF vUserName AS VARIANT, _

OPTIONAL BYREF vPassword AS VARIANT _

)

 

Arguments

 

bstrLocalName

BSTR. The local name to assign to the connected printer.

bstrRemoteName

BSTR. The name of the remote printer.

vUpdateProfile

Optional. VARIANT. Boolean value indicating whether the printer mapping is stored in the current user's profile. If vUpdateProfile is supplied and has a value of true, the mapping is stored in the user profile (the default is false).

vUserName

Optional. VARIANT. String value indicating the user name. If you are mapping a remote printer using the profile of someone other than current user, you can specify vUserName and vPassword.

vPassword

Optional. VARIANT. String value indicating the user password. If you are mapping a remote printer using the profile of someone other than current user, you can specify vUserName and vPassword.

 
Remarks

 

The AddPrinterConnection method adds a network printer to an MS-DOS printer port, such as LPT1. You cannot use this method to add a remote Windows-based printer connection. To add a remote Windows-based printer connection, use the AddWindowsPrinterConnection method.

 

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)

 

Valid XHTML 1.0 Transitional