PROBLEM: Adding a printer via API, then creating a printer Share via API (source included) 
Author Message
 PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)

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

I really need help with this.  I can  create the printer device, but I can
not create a share of that (or any) printer progammatically.  Whats more, I
can not create a share using an existing printer and the NET SHARE command.
I've tried every variation of this command and it still does not work.  The
closest I get is when "NET SHARE sharename=LPT1:" returnes an error "123"
which means "The filename, directoryname, or volume label syntax is
incorrect.".  This error "123" is the code returned by my NetShareAdd()
command below.

Please help me find the problem...

don_ashworth(at)bmc(dot)com

Create a simple VB project, as a bas module and the following code...
--------------------------------
Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" (ByVal
pName As String, ByVal Level As Long, pPrinter As Any) As Long

Declare Function NetShareAdd Lib "netapi32.dll" (ByVal servername As String,
ByVal Level As Long, LPBYTE As Any, lpParm_Err As Long) As Long

    ' -------------
    ' Print APIs
    ' -------------

    Const ACCESS_ALL = 255
    Const STYPE_PRINTQ = 1

    '  size of a device name string
    Const CCHDEVICENAME = 32

    '  size of a form name string
    Const CCHFORMNAME = 32

    Const PRINTER_ENUM_LOCAL = &H2

    Type ACL
            AclRevision As Byte
            Sbz1 As Byte
            AclSize As Integer
            AceCount As Integer
            Sbz2 As Integer
    End Type

    Type DEVMODE
            dmDeviceName As String * CCHDEVICENAME
            dmSpecVersion As Integer
            dmDriverVersion As Integer
            dmSize As Integer
            dmDriverExtra As Integer
            dmFields As Long
            dmOrientation As Integer
            dmPaperSize As Integer
            dmPaperLength As Integer
            dmPaperWidth As Integer
            dmScale As Integer
            dmCopies As Integer
            dmDefaultSource As Integer
            dmPrintQuality As Integer
            dmColor As Integer
            dmDuplex As Integer
            dmYResolution As Integer
            dmTTOption As Integer
            dmCollate As Integer
            dmFormName As String * CCHFORMNAME
            dmUnusedPadding As Integer
            dmBitsPerPel As Long
            dmPelsWidth As Long
            dmPelsHeight As Long
            dmDisplayFlags As Long
            dmDisplayFrequency As Long
    End Type

    Type SECURITY_DESCRIPTOR
            Revision As Byte
            Sbz1 As Byte
            Control As Long
            Owner As Long
            Group As Long
            Sacl As ACL
            Dacl As ACL
    End Type

    Type PRINTER_INFO_2
            pServerName As String
            pPrinterName As String
            pShareName As String
            pPortName As String
            pDriverName As String
            pComment As String
            pLocation As String
            pDevMode As Long
            pSepFile As String
            pPrintProcessor As String
            pDatatype As String
            pParameters As String
            pSecurityDescriptor As Long
            Attributes As Long
            Priority As Long
            DefaultPriority As Long
            StartTime As Long
            UntilTime As Long
            Status As Long
            cJobs As Long
            AveragePPM As Long
    End Type

    Type DRIVER_INFO_2
            cVersion As Long
            pName As String
            pEnvironment As String
            pDriverPath As String
            pDataFile As String
            pConfigFile As String
    End Type

    Private Type PRINTER_INFO_1
            flags As Long
            pDescription As String
            pName As String
            pComment As String
    End Type

    Type SHARE_INFO_2
      sNetName As String
      sType As Long
      sRemark As String
      {*filter*}issions As Long
      sMaxUses As Long
      sCurrentUses As Long
      sPath As String
      sPasswd As String
    End Type

Add a command button called cmdCOMMAND, place the code below under the
buttton...
---------------------------------------------
Private Sub cmdCOMMAND_Click()

    Dim strPRINTER As String
    Dim strSERVER As String
    Dim lngRETURN As Long
    Dim usrPRINTER As PRINTER_INFO_2
    Dim usrSHARE As SHARE_INFO_2
    Dim lngERRMBR As Long

    strSERVER = Null   '   Use the default machine name...

    '   Populate the printer info here...
    '
    With usrPRINTER
        .pServerName = strSERVER
        .pPrinterName = "testprinter"
        .pShareName = "testprinter"
        .pPortName = "LPT1:"
        .pDriverName = "HP LaserJet 5"
        .pComment = ""
        .pLocation = ""
        .pSepFile = ""
        .pPrintProcessor = "winprint"
        .pDatatype = ""
        .pParameters = ""
        .Attributes = 0
        .Priority = 0
        .DefaultPriority = 0
        .StartTime = 0
        .UntilTime = 0
        .Status = 0
        .cJobs = 0
        .AveragePPM = 0
    End With

    '   This works great..
    '
    lngRETURN = AddPrinter(strSERVER, 2, usrPRINTER)

    '   Populate the share info here...
    '
    With usrSHARE
        .sNetName = usrPRINTER.pShareName
        .sType = STYPE_PRINTQ
        .sRemark = ""
        .{*filter*}issions = ACCESS_ALL
        .sMaxUses = 1
        .sCurrentUses = 0
        .sPath = usrPRINTER.pPrinterName
        .sPasswd = "" & Null
    End With

    '   This returns 123, which is "The filename, directory, or volume
    '   label syntax is incorrect'...
    '
    '   I get the same thing when the following commandline is executed;
    '   NET SHARE sharename=LPT1:
    '   By the way, I can not find the correct syntax to add a printer
    '   share by way of the NET SHARE command.
    '
    lngRETURN = NetShareAdd(strSERVER, 2, usrSHARE, lngERRMBR)

End Sub



Tue, 16 Jul 2002 03:00:00 GMT  
 PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)
PROBLEM: Adding a printer via API, then creating a printer Share via API
(source included)

I really need help with this.  I can  create the printer device, but I can
not create a share of that (or any) printer progammatically.  Whats more, I
can not create a share using an existing printer and the NET SHARE command.
I've tried every variation of this command and it still does not work.  The
closest I get is when "NET SHARE sharename=LPT1:" returnes an error "123"
which means "The filename, directoryname, or volume label syntax is
incorrect.".  This error "123" is the code returned by my NetShareAdd()
command below.

Please help me find the problem...

don_ashworth(at)bmc(dot)com

Create a simple VB project, as a bas module and the following code...
--------------------------------
Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" (ByVal
pName As String, ByVal Level As Long, pPrinter As Any) As Long

Declare Function NetShareAdd Lib "netapi32.dll" (ByVal servername As String,
ByVal Level As Long, LPBYTE As Any, lpParm_Err As Long) As Long

    ' -------------
    ' Print APIs
    ' -------------

    Const ACCESS_ALL = 255
    Const STYPE_PRINTQ = 1

    '  size of a device name string
    Const CCHDEVICENAME = 32

    '  size of a form name string
    Const CCHFORMNAME = 32

    Const PRINTER_ENUM_LOCAL = &H2

    Type ACL
            AclRevision As Byte
            Sbz1 As Byte
            AclSize As Integer
            AceCount As Integer
            Sbz2 As Integer
    End Type

    Type DEVMODE
            dmDeviceName As String * CCHDEVICENAME
            dmSpecVersion As Integer
            dmDriverVersion As Integer
            dmSize As Integer
            dmDriverExtra As Integer
            dmFields As Long
            dmOrientation As Integer
            dmPaperSize As Integer
            dmPaperLength As Integer
            dmPaperWidth As Integer
            dmScale As Integer
            dmCopies As Integer
            dmDefaultSource As Integer
            dmPrintQuality As Integer
            dmColor As Integer
            dmDuplex As Integer
            dmYResolution As Integer
            dmTTOption As Integer
            dmCollate As Integer
            dmFormName As String * CCHFORMNAME
            dmUnusedPadding As Integer
            dmBitsPerPel As Long
            dmPelsWidth As Long
            dmPelsHeight As Long
            dmDisplayFlags As Long
            dmDisplayFrequency As Long
    End Type

    Type SECURITY_DESCRIPTOR
            Revision As Byte
            Sbz1 As Byte
            Control As Long
            Owner As Long
            Group As Long
            Sacl As ACL
            Dacl As ACL
    End Type

    Type PRINTER_INFO_2
            pServerName As String
            pPrinterName As String
            pShareName As String
            pPortName As String
            pDriverName As String
            pComment As String
            pLocation As String
            pDevMode As Long
            pSepFile As String
            pPrintProcessor As String
            pDatatype As String
            pParameters As String
            pSecurityDescriptor As Long
            Attributes As Long
            Priority As Long
            DefaultPriority As Long
            StartTime As Long
            UntilTime As Long
            Status As Long
            cJobs As Long
            AveragePPM As Long
    End Type

    Type DRIVER_INFO_2
            cVersion As Long
            pName As String
            pEnvironment As String
            pDriverPath As String
            pDataFile As String
            pConfigFile As String
    End Type

    Private Type PRINTER_INFO_1
            flags As Long
            pDescription As String
            pName As String
            pComment As String
    End Type

    Type SHARE_INFO_2
      sNetName As String
      sType As Long
      sRemark As String
      {*filter*}issions As Long
      sMaxUses As Long
      sCurrentUses As Long
      sPath As String
      sPasswd As String
    End Type

Add a command button called cmdCOMMAND, place the code below under the
buttton...
---------------------------------------------
Private Sub cmdCOMMAND_Click()

    Dim strPRINTER As String
    Dim strSERVER As String
    Dim lngRETURN As Long
    Dim usrPRINTER As PRINTER_INFO_2
    Dim usrSHARE As SHARE_INFO_2
    Dim lngERRMBR As Long

    strSERVER = Null   '   Use the default machine name...

    '   Populate the printer info here...
    '
    With usrPRINTER
        .pServerName = strSERVER
        .pPrinterName = "testprinter"
        .pShareName = "testprinter"
        .pPortName = "LPT1:"
        .pDriverName = "HP LaserJet 5"
        .pComment = ""
        .pLocation = ""
        .pSepFile = ""
        .pPrintProcessor = "winprint"
        .pDatatype = ""
        .pParameters = ""
        .Attributes = 0
        .Priority = 0
        .DefaultPriority = 0
        .StartTime = 0
        .UntilTime = 0
        .Status = 0
        .cJobs = 0
        .AveragePPM = 0
    End With

    '   This works great..
    '
    lngRETURN = AddPrinter(strSERVER, 2, usrPRINTER)

    '   Populate the share info here...
    '
    With usrSHARE
        .sNetName = usrPRINTER.pShareName
        .sType = STYPE_PRINTQ
        .sRemark = ""
        .{*filter*}issions = ACCESS_ALL
        .sMaxUses = 1
        .sCurrentUses = 0
        .sPath = usrPRINTER.pPrinterName
        .sPasswd = "" & Null
    End With

    '   This returns 123, which is "The filename, directory, or volume
    '   label syntax is incorrect'...
    '
    '   I get the same thing when the following commandline is executed;
    '   NET SHARE sharename=LPT1:
    '   By the way, I can not find the correct syntax to add a printer
    '   share by way of the NET SHARE command.
    '
    lngRETURN = NetShareAdd(strSERVER, 2, usrSHARE, lngERRMBR)

End Sub



Tue, 16 Jul 2002 03:00:00 GMT  
 PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)


Fri, 19 Jun 1992 00:00:00 GMT  
 PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)
Fred --

Unfortunately, I don't have an answer, but a related problem.  I'm using
identical code as yours to add a printer to my local machine (Win2000).  The
only difference is the following:

.pServerName = "" (for local machine - right?)
.pPortName = "\\ch501\ch_5si" (for unc)

But I keep on getting '1114' (a dll initialization routine failed) -- any
thoughts as to why?

Anyone else?

Thanks in advance..
-Jeff

Quote:

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

> I really need help with this.  I can  create the printer device, but I can
> not create a share of that (or any) printer progammatically.  Whats more, I
> can not create a share using an existing printer and the NET SHARE command.
> I've tried every variation of this command and it still does not work.  The
> closest I get is when "NET SHARE sharename=LPT1:" returnes an error "123"
> which means "The filename, directoryname, or volume label syntax is
> incorrect.".  This error "123" is the code returned by my NetShareAdd()
> command below.

> Please help me find the problem...

> don_ashworth(at)bmc(dot)com

> Create a simple VB project, as a bas module and the following code...
> --------------------------------
> Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" (ByVal
> pName As String, ByVal Level As Long, pPrinter As Any) As Long

> Declare Function NetShareAdd Lib "netapi32.dll" (ByVal servername As String,
> ByVal Level As Long, LPBYTE As Any, lpParm_Err As Long) As Long

>     ' -------------
>     ' Print APIs
>     ' -------------

>     Const ACCESS_ALL = 255
>     Const STYPE_PRINTQ = 1

>     '  size of a device name string
>     Const CCHDEVICENAME = 32

>     '  size of a form name string
>     Const CCHFORMNAME = 32

>     Const PRINTER_ENUM_LOCAL = &H2

>     Type ACL
>             AclRevision As Byte
>             Sbz1 As Byte
>             AclSize As Integer
>             AceCount As Integer
>             Sbz2 As Integer
>     End Type

>     Type DEVMODE
>             dmDeviceName As String * CCHDEVICENAME
>             dmSpecVersion As Integer
>             dmDriverVersion As Integer
>             dmSize As Integer
>             dmDriverExtra As Integer
>             dmFields As Long
>             dmOrientation As Integer
>             dmPaperSize As Integer
>             dmPaperLength As Integer
>             dmPaperWidth As Integer
>             dmScale As Integer
>             dmCopies As Integer
>             dmDefaultSource As Integer
>             dmPrintQuality As Integer
>             dmColor As Integer
>             dmDuplex As Integer
>             dmYResolution As Integer
>             dmTTOption As Integer
>             dmCollate As Integer
>             dmFormName As String * CCHFORMNAME
>             dmUnusedPadding As Integer
>             dmBitsPerPel As Long
>             dmPelsWidth As Long
>             dmPelsHeight As Long
>             dmDisplayFlags As Long
>             dmDisplayFrequency As Long
>     End Type

>     Type SECURITY_DESCRIPTOR
>             Revision As Byte
>             Sbz1 As Byte
>             Control As Long
>             Owner As Long
>             Group As Long
>             Sacl As ACL
>             Dacl As ACL
>     End Type

>     Type PRINTER_INFO_2
>             pServerName As String
>             pPrinterName As String
>             pShareName As String
>             pPortName As String
>             pDriverName As String
>             pComment As String
>             pLocation As String
>             pDevMode As Long
>             pSepFile As String
>             pPrintProcessor As String
>             pDatatype As String
>             pParameters As String
>             pSecurityDescriptor As Long
>             Attributes As Long
>             Priority As Long
>             DefaultPriority As Long
>             StartTime As Long
>             UntilTime As Long
>             Status As Long
>             cJobs As Long
>             AveragePPM As Long
>     End Type

>     Type DRIVER_INFO_2
>             cVersion As Long
>             pName As String
>             pEnvironment As String
>             pDriverPath As String
>             pDataFile As String
>             pConfigFile As String
>     End Type

>     Private Type PRINTER_INFO_1
>             flags As Long
>             pDescription As String
>             pName As String
>             pComment As String
>     End Type

>     Type SHARE_INFO_2
>       sNetName As String
>       sType As Long
>       sRemark As String
>       {*filter*}issions As Long
>       sMaxUses As Long
>       sCurrentUses As Long
>       sPath As String
>       sPasswd As String
>     End Type

> Add a command button called cmdCOMMAND, place the code below under the
> buttton...
> ---------------------------------------------
> Private Sub cmdCOMMAND_Click()

>     Dim strPRINTER As String
>     Dim strSERVER As String
>     Dim lngRETURN As Long
>     Dim usrPRINTER As PRINTER_INFO_2
>     Dim usrSHARE As SHARE_INFO_2
>     Dim lngERRMBR As Long

>     strSERVER = Null   '   Use the default machine name...

>     '   Populate the printer info here...
>     '
>     With usrPRINTER
>         .pServerName = strSERVER
>         .pPrinterName = "testprinter"
>         .pShareName = "testprinter"
>         .pPortName = "LPT1:"
>         .pDriverName = "HP LaserJet 5"
>         .pComment = ""
>         .pLocation = ""
>         .pSepFile = ""
>         .pPrintProcessor = "winprint"
>         .pDatatype = ""
>         .pParameters = ""
>         .Attributes = 0
>         .Priority = 0
>         .DefaultPriority = 0
>         .StartTime = 0
>         .UntilTime = 0
>         .Status = 0
>         .cJobs = 0
>         .AveragePPM = 0
>     End With

>     '   This works great..
>     '
>     lngRETURN = AddPrinter(strSERVER, 2, usrPRINTER)

>     '   Populate the share info here...
>     '
>     With usrSHARE
>         .sNetName = usrPRINTER.pShareName
>         .sType = STYPE_PRINTQ
>         .sRemark = ""
>         .{*filter*}issions = ACCESS_ALL
>         .sMaxUses = 1
>         .sCurrentUses = 0
>         .sPath = usrPRINTER.pPrinterName
>         .sPasswd = "" & Null
>     End With

>     '   This returns 123, which is "The filename, directory, or volume
>     '   label syntax is incorrect'...
>     '
>     '   I get the same thing when the following commandline is executed;
>     '   NET SHARE sharename=LPT1:
>     '   By the way, I can not find the correct syntax to add a printer
>     '   share by way of the NET SHARE command.
>     '
>     lngRETURN = NetShareAdd(strSERVER, 2, usrSHARE, lngERRMBR)

> End Sub



Tue, 23 Jul 2002 03:00:00 GMT  
 PROBLEM: Adding a printer via API, then creating a printer Share via API (source included)
I used  LPT1:, LPT2: or LPT3 (could use FILE: too) for PortName.  You can
leave ServerName Null, and it will create the device on the local machine
(assumming you have the rights).

I'm finally able to create a printer and share it.  I just can't delete any
printers via the DeletePrinter() API call.  It keeps returning a 0...which
means failure.

Hope this helps.
Don

Quote:

>Fred --

>Unfortunately, I don't have an answer, but a related problem.  I'm using
>identical code as yours to add a printer to my local machine (Win2000).
The
>only difference is the following:

>.pServerName = "" (for local machine - right?)
>.pPortName = "\\ch501\ch_5si" (for unc)

>But I keep on getting '1114' (a dll initialization routine failed) -- any
>thoughts as to why?

>Anyone else?

>Thanks in advance..
>-Jeff


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

>> I really need help with this.  I can  create the printer device, but I
can
>> not create a share of that (or any) printer progammatically.  Whats more,
I
>> can not create a share using an existing printer and the NET SHARE
command.
>> I've tried every variation of this command and it still does not work.
The
>> closest I get is when "NET SHARE sharename=LPT1:" returnes an error "123"
>> which means "The filename, directoryname, or volume label syntax is
>> incorrect.".  This error "123" is the code returned by my NetShareAdd()
>> command below.

>> Please help me find the problem...

>> don_ashworth(at)bmc(dot)com

>> Create a simple VB project, as a bas module and the following code...
>> --------------------------------
>> Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" (ByVal
>> pName As String, ByVal Level As Long, pPrinter As Any) As Long

>> Declare Function NetShareAdd Lib "netapi32.dll" (ByVal servername As
String,
>> ByVal Level As Long, LPBYTE As Any, lpParm_Err As Long) As Long

>>     ' -------------
>>     ' Print APIs
>>     ' -------------

>>     Const ACCESS_ALL = 255
>>     Const STYPE_PRINTQ = 1

>>     '  size of a device name string
>>     Const CCHDEVICENAME = 32

>>     '  size of a form name string
>>     Const CCHFORMNAME = 32

>>     Const PRINTER_ENUM_LOCAL = &H2

>>     Type ACL
>>             AclRevision As Byte
>>             Sbz1 As Byte
>>             AclSize As Integer
>>             AceCount As Integer
>>             Sbz2 As Integer
>>     End Type

>>     Type DEVMODE
>>             dmDeviceName As String * CCHDEVICENAME
>>             dmSpecVersion As Integer
>>             dmDriverVersion As Integer
>>             dmSize As Integer
>>             dmDriverExtra As Integer
>>             dmFields As Long
>>             dmOrientation As Integer
>>             dmPaperSize As Integer
>>             dmPaperLength As Integer
>>             dmPaperWidth As Integer
>>             dmScale As Integer
>>             dmCopies As Integer
>>             dmDefaultSource As Integer
>>             dmPrintQuality As Integer
>>             dmColor As Integer
>>             dmDuplex As Integer
>>             dmYResolution As Integer
>>             dmTTOption As Integer
>>             dmCollate As Integer
>>             dmFormName As String * CCHFORMNAME
>>             dmUnusedPadding As Integer
>>             dmBitsPerPel As Long
>>             dmPelsWidth As Long
>>             dmPelsHeight As Long
>>             dmDisplayFlags As Long
>>             dmDisplayFrequency As Long
>>     End Type

>>     Type SECURITY_DESCRIPTOR
>>             Revision As Byte
>>             Sbz1 As Byte
>>             Control As Long
>>             Owner As Long
>>             Group As Long
>>             Sacl As ACL
>>             Dacl As ACL
>>     End Type

>>     Type PRINTER_INFO_2
>>             pServerName As String
>>             pPrinterName As String
>>             pShareName As String
>>             pPortName As String
>>             pDriverName As String
>>             pComment As String
>>             pLocation As String
>>             pDevMode As Long
>>             pSepFile As String
>>             pPrintProcessor As String
>>             pDatatype As String
>>             pParameters As String
>>             pSecurityDescriptor As Long
>>             Attributes As Long
>>             Priority As Long
>>             DefaultPriority As Long
>>             StartTime As Long
>>             UntilTime As Long
>>             Status As Long
>>             cJobs As Long
>>             AveragePPM As Long
>>     End Type

>>     Type DRIVER_INFO_2
>>             cVersion As Long
>>             pName As String
>>             pEnvironment As String
>>             pDriverPath As String
>>             pDataFile As String
>>             pConfigFile As String
>>     End Type

>>     Private Type PRINTER_INFO_1
>>             flags As Long
>>             pDescription As String
>>             pName As String
>>             pComment As String
>>     End Type

>>     Type SHARE_INFO_2
>>       sNetName As String
>>       sType As Long
>>       sRemark As String
>>       {*filter*}issions As Long
>>       sMaxUses As Long
>>       sCurrentUses As Long
>>       sPath As String
>>       sPasswd As String
>>     End Type

>> Add a command button called cmdCOMMAND, place the code below under the
>> buttton...
>> ---------------------------------------------
>> Private Sub cmdCOMMAND_Click()

>>     Dim strPRINTER As String
>>     Dim strSERVER As String
>>     Dim lngRETURN As Long
>>     Dim usrPRINTER As PRINTER_INFO_2
>>     Dim usrSHARE As SHARE_INFO_2
>>     Dim lngERRMBR As Long

>>     strSERVER = Null   '   Use the default machine name...

>>     '   Populate the printer info here...
>>     '
>>     With usrPRINTER
>>         .pServerName = strSERVER
>>         .pPrinterName = "testprinter"
>>         .pShareName = "testprinter"
>>         .pPortName = "LPT1:"
>>         .pDriverName = "HP LaserJet 5"
>>         .pComment = ""
>>         .pLocation = ""
>>         .pSepFile = ""
>>         .pPrintProcessor = "winprint"
>>         .pDatatype = ""
>>         .pParameters = ""
>>         .Attributes = 0
>>         .Priority = 0
>>         .DefaultPriority = 0
>>         .StartTime = 0
>>         .UntilTime = 0
>>         .Status = 0
>>         .cJobs = 0
>>         .AveragePPM = 0
>>     End With

>>     '   This works great..
>>     '
>>     lngRETURN = AddPrinter(strSERVER, 2, usrPRINTER)

>>     '   Populate the share info here...
>>     '
>>     With usrSHARE
>>         .sNetName = usrPRINTER.pShareName
>>         .sType = STYPE_PRINTQ
>>         .sRemark = ""
>>         .{*filter*}issions = ACCESS_ALL
>>         .sMaxUses = 1
>>         .sCurrentUses = 0
>>         .sPath = usrPRINTER.pPrinterName
>>         .sPasswd = "" & Null
>>     End With

>>     '   This returns 123, which is "The filename, directory, or volume
>>     '   label syntax is incorrect'...
>>     '
>>     '   I get the same thing when the following commandline is executed;
>>     '   NET SHARE sharename=LPT1:
>>     '   By the way, I can not find the correct syntax to add a printer
>>     '   share by way of the NET SHARE command.
>>     '
>>     lngRETURN = NetShareAdd(strSERVER, 2, usrSHARE, lngERRMBR)

>> End Sub



Tue, 23 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. HELP: TYPING TO CREATE A PRINTER VIA API - AddPrinter VB

2. HELP: Changing Printer Fonts via API

3. Printer common dialog via api

4. Accessing the printer defaults via the API

5. Printer selection via API call

6. How to set printer property via API (download ttfs)

7. Setting via API the default printer settings

8. URGENT: How to install a new printer via API

9. Changing Default Printer via API

10. problem creating shortcut via API

11. bug sending text to printer via printer object

12. Setting up user access and shares via API...

 

 
Powered by phpBB® Forum Software