Bonjour tout le monde.
Aujourd'hui est mon premier jour apres mon mariage de samedi dernier et je dois être dans le gaz.
Je n'arrive pas à partager une imprimante que je viens d'installer par soft.
Voila mon code fautif

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Public Function SharePrinter(ByVal PrinterName As String) As Long
  Dim si2 As SHARE_INFO_2
  Dim parmerr As Long
  parmerr = 0
  si2.shi2_netname = PrinterName 'the name of the share
  si2.shi2_type = STYPE_PRINTQ 'the share is a PRINTER
  si2.shi2_remark = "Imprimante ADDPI" & vbNullChar 'the comment
  si2.shi2_permissions = 0 'this should be ignored
  si2.shi2_max_uses = -1 'unlimited connections
  si2.shi2_current_uses = 0 'I don't think this is applicable
  si2.shi2_path = PrinterName  'the path to the share
  si2.shi2_passwd = vbNullString ' the password 'this should be ignored
    SharePrinter = NetShareAdd(vbNullString, 2, si2, parmerr)
  If Not SharePrinter Then
    Debug.Print GetSystemErrDescription 'sous routine pour afficher le texte de l'erreur
  End If
 
End Function
Si un féru des api pouvait me donner un coup de main ?