Traduire un code VB en VB Script pour une page ASP du code suivant ou comment utiliser une fonction inclue dans un dll ?
Declare Function wu_GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Declare Function wu_GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
Function ap_GetComputerName() As Variant
Dim strComputerName As String
Dim lngLength As Long
Dim lngResult As Long
strComputerName = String$(255, 0)
lngLength = 255
lngResult = wu_GetComputerName(strComputerName, lngLength)
ap_GetComputerName = _
Left(strComputerName, InStr(1, strComputerName, Chr(0)) - 1)
End Function
Function ap_GetUsername() As Variant
Dim strUserName As String
Dim lngLength As Long
Dim lngResult As Long
'-- Set up the buffer
strUserName = String$(255, 0)
lngLength = 255
'-- Make the call
lngResult = wu_GetUserName(strUserName, lngLength)
'-- Assign the value
ap_GetUsername = Left(strUserName, lngLength)
End Function