Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Bismark Prods
sPrinterName: Le nom de l'imprimante sDriver: La chaine de caractère qui indique le driver sPort: Le port de l'imprimante sComment: Le commentaire associé à l'imprimante
Exemple:
dim variable as string variable = InstallPrinter("Epson", "Epson Stylus COLOR 440", "LPT1:", ,"Mon imprimante") MsgBox "Imprimante ajoutée: " & variable
Ti£oi$
Private 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
Private Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" _ (ByVal pName As String, ByVal Level As Long, pPrinter As Any) As Long Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As _ Long) As Long
Function InstallPrinter(ByVal sPrinterName As String, ByVal sDriver As String, _ Optional ByVal sPort As String = "LPT1:", Optional sServer As String, _ Optional sComment As String) As Boolean Dim hPrinter As Long Dim PI As PRINTER_INFO_2
With PI .pPrinterName = sPrinterName .pDriverName = sDriver .pPortName = sPort .pServerName = sServer .pComment = sComment .pPrintProcessor = "WinPrint" .Priority = 1 .DefaultPriority = 1 .pDatatype = "RAW" End With hPrinter = AddPrinter(sServer, 2, PI)
If hPrinter <> 0 Then ClosePrinter hPrinter InstallPrinter = True End If
End Function
"Jeff" a écrit dans le message de news:3fc0b481$0$2786$
Bonjour, juste une petite question, comment installer une nouvelle imprimante sur un poste NT via Visual-Basic ?
Merci Jf
sPrinterName: Le nom de l'imprimante
sDriver: La chaine de caractère qui indique le driver
sPort: Le port de l'imprimante
sComment: Le commentaire associé à l'imprimante
Exemple:
dim variable as string
variable = InstallPrinter("Epson", "Epson Stylus COLOR 440", "LPT1:", ,"Mon
imprimante")
MsgBox "Imprimante ajoutée: " & variable
Ti£oi$
Private 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
Private Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" _
(ByVal pName As String, ByVal Level As Long, pPrinter As Any) As Long
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As
_
Long) As Long
Function InstallPrinter(ByVal sPrinterName As String, ByVal sDriver As
String, _
Optional ByVal sPort As String = "LPT1:", Optional sServer As String, _
Optional sComment As String) As Boolean
Dim hPrinter As Long
Dim PI As PRINTER_INFO_2
With PI
.pPrinterName = sPrinterName
.pDriverName = sDriver
.pPortName = sPort
.pServerName = sServer
.pComment = sComment
.pPrintProcessor = "WinPrint"
.Priority = 1
.DefaultPriority = 1
.pDatatype = "RAW"
End With
hPrinter = AddPrinter(sServer, 2, PI)
If hPrinter <> 0 Then
ClosePrinter hPrinter
InstallPrinter = True
End If
End Function
"Jeff" <mail@free.fr> a écrit dans le message de
news:3fc0b481$0$2786$626a54ce@news.free.fr...
Bonjour, juste une petite question, comment installer une nouvelle
imprimante sur un poste NT via Visual-Basic ?
sPrinterName: Le nom de l'imprimante sDriver: La chaine de caractère qui indique le driver sPort: Le port de l'imprimante sComment: Le commentaire associé à l'imprimante
Exemple:
dim variable as string variable = InstallPrinter("Epson", "Epson Stylus COLOR 440", "LPT1:", ,"Mon imprimante") MsgBox "Imprimante ajoutée: " & variable
Ti£oi$
Private 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
Private Declare Function AddPrinter Lib "winspool.drv" Alias "AddPrinterA" _ (ByVal pName As String, ByVal Level As Long, pPrinter As Any) As Long Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As _ Long) As Long
Function InstallPrinter(ByVal sPrinterName As String, ByVal sDriver As String, _ Optional ByVal sPort As String = "LPT1:", Optional sServer As String, _ Optional sComment As String) As Boolean Dim hPrinter As Long Dim PI As PRINTER_INFO_2
With PI .pPrinterName = sPrinterName .pDriverName = sDriver .pPortName = sPort .pServerName = sServer .pComment = sComment .pPrintProcessor = "WinPrint" .Priority = 1 .DefaultPriority = 1 .pDatatype = "RAW" End With hPrinter = AddPrinter(sServer, 2, PI)
If hPrinter <> 0 Then ClosePrinter hPrinter InstallPrinter = True End If
End Function
"Jeff" a écrit dans le message de news:3fc0b481$0$2786$
Bonjour, juste une petite question, comment installer une nouvelle imprimante sur un poste NT via Visual-Basic ?