Bonjour,
Je souhaite pouvoir r=E9cup=E9rer le login et le nom de la=20
machine qui execute une base de donn=E9es sous access.(sur=20
l'intranet)
Existe -t-il une commande ?
Merci.
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
ng
Salut,
Tu peux utiliser GetComputerName :
'example by Donavon Kuhn () Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub Form_Load() Dim dwLen As Long Dim strString As String 'Create a buffer dwLen = MAX_COMPUTERNAME_LENGTH + 1 strString = String(dwLen, "X") 'Get the computer name GetComputerName strString, dwLen 'get only the actual data strString = Left(strString, dwLen) 'Show the computer name MsgBox strString End Sub
Ou encore GetComputerNameEx :
Private Enum COMPUTER_NAME_FORMAT ComputerNameNetBIOS ComputerNameDnsHostname ComputerNameDnsDomain ComputerNameDnsFullyQualified ComputerNamePhysicalNetBIOS ComputerNamePhysicalDnsHostname ComputerNamePhysicalDnsDomain ComputerNamePhysicalDnsFullyQualified ComputerNameMax End Enum Private Declare Function GetComputerNameEx Lib "kernel32.dll" Alias "GetComputerNameExA" (ByVal NameType As COMPUTER_NAME_FORMAT, ByVal lpBuffer As String, ByRef nSize As Long) As Long Private Sub Form_Load() 'KPD-Team 2001 'URL: http://www.allapi.net/ 'E-Mail: ShowName ComputerNameNetBIOS, "NetBIOS name" ShowName ComputerNameDnsHostname, "DNS host name" ShowName ComputerNameDnsDomain, "DNS Domain" ShowName ComputerNameDnsFullyQualified, "Fully qualified DNS name" ShowName ComputerNamePhysicalNetBIOS, "Physical NetBIOS name" End Sub Private Sub ShowName(lIndex As COMPUTER_NAME_FORMAT, Description As String) Dim Ret As Long, sBuffer As String 'create a buffer sBuffer = Space(256) Ret = Len(sBuffer) 'retrieve the computer name If GetComputerNameEx(lIndex, sBuffer, Ret) <> 0 And Ret > 0 Then 'show it Debug.Print Description + ": " + Left$(sBuffer, Ret) End If End Sub
Pour plus d'infos regarde dans l'API-Guide : http://www.allapi.net
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"Gregory Lamotte" a écrit dans le message de news: c60f01c3eef1$c5ff2e70$ Bonjour, Je souhaite pouvoir récupérer le login et le nom de la machine qui execute une base de données sous access.(sur l'intranet) Existe -t-il une commande ? Merci.
Salut,
Tu peux utiliser GetComputerName :
'example by Donavon Kuhn (Donavon.Kuhn@Nextel.com)
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Dim dwLen As Long
Dim strString As String
'Create a buffer
dwLen = MAX_COMPUTERNAME_LENGTH + 1
strString = String(dwLen, "X")
'Get the computer name
GetComputerName strString, dwLen
'get only the actual data
strString = Left(strString, dwLen)
'Show the computer name
MsgBox strString
End Sub
Ou encore GetComputerNameEx :
Private Enum COMPUTER_NAME_FORMAT
ComputerNameNetBIOS
ComputerNameDnsHostname
ComputerNameDnsDomain
ComputerNameDnsFullyQualified
ComputerNamePhysicalNetBIOS
ComputerNamePhysicalDnsHostname
ComputerNamePhysicalDnsDomain
ComputerNamePhysicalDnsFullyQualified
ComputerNameMax
End Enum
Private Declare Function GetComputerNameEx Lib "kernel32.dll" Alias
"GetComputerNameExA" (ByVal NameType As COMPUTER_NAME_FORMAT, ByVal lpBuffer
As String, ByRef nSize As Long) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@allapi.net
ShowName ComputerNameNetBIOS, "NetBIOS name"
ShowName ComputerNameDnsHostname, "DNS host name"
ShowName ComputerNameDnsDomain, "DNS Domain"
ShowName ComputerNameDnsFullyQualified, "Fully qualified DNS name"
ShowName ComputerNamePhysicalNetBIOS, "Physical NetBIOS name"
End Sub
Private Sub ShowName(lIndex As COMPUTER_NAME_FORMAT, Description As String)
Dim Ret As Long, sBuffer As String
'create a buffer
sBuffer = Space(256)
Ret = Len(sBuffer)
'retrieve the computer name
If GetComputerNameEx(lIndex, sBuffer, Ret) <> 0 And Ret > 0 Then
'show it
Debug.Print Description + ": " + Left$(sBuffer, Ret)
End If
End Sub
Pour plus d'infos regarde dans l'API-Guide : http://www.allapi.net
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
"Gregory Lamotte" <anonymous@discussions.microsoft.com> a écrit dans le
message de news: c60f01c3eef1$c5ff2e70$a101280a@phx.gbl...
Bonjour,
Je souhaite pouvoir récupérer le login et le nom de la
machine qui execute une base de données sous access.(sur
l'intranet)
Existe -t-il une commande ?
Merci.
'example by Donavon Kuhn () Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub Form_Load() Dim dwLen As Long Dim strString As String 'Create a buffer dwLen = MAX_COMPUTERNAME_LENGTH + 1 strString = String(dwLen, "X") 'Get the computer name GetComputerName strString, dwLen 'get only the actual data strString = Left(strString, dwLen) 'Show the computer name MsgBox strString End Sub
Ou encore GetComputerNameEx :
Private Enum COMPUTER_NAME_FORMAT ComputerNameNetBIOS ComputerNameDnsHostname ComputerNameDnsDomain ComputerNameDnsFullyQualified ComputerNamePhysicalNetBIOS ComputerNamePhysicalDnsHostname ComputerNamePhysicalDnsDomain ComputerNamePhysicalDnsFullyQualified ComputerNameMax End Enum Private Declare Function GetComputerNameEx Lib "kernel32.dll" Alias "GetComputerNameExA" (ByVal NameType As COMPUTER_NAME_FORMAT, ByVal lpBuffer As String, ByRef nSize As Long) As Long Private Sub Form_Load() 'KPD-Team 2001 'URL: http://www.allapi.net/ 'E-Mail: ShowName ComputerNameNetBIOS, "NetBIOS name" ShowName ComputerNameDnsHostname, "DNS host name" ShowName ComputerNameDnsDomain, "DNS Domain" ShowName ComputerNameDnsFullyQualified, "Fully qualified DNS name" ShowName ComputerNamePhysicalNetBIOS, "Physical NetBIOS name" End Sub Private Sub ShowName(lIndex As COMPUTER_NAME_FORMAT, Description As String) Dim Ret As Long, sBuffer As String 'create a buffer sBuffer = Space(256) Ret = Len(sBuffer) 'retrieve the computer name If GetComputerNameEx(lIndex, sBuffer, Ret) <> 0 And Ret > 0 Then 'show it Debug.Print Description + ": " + Left$(sBuffer, Ret) End If End Sub
Pour plus d'infos regarde dans l'API-Guide : http://www.allapi.net
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
"Gregory Lamotte" a écrit dans le message de news: c60f01c3eef1$c5ff2e70$ Bonjour, Je souhaite pouvoir récupérer le login et le nom de la machine qui execute une base de données sous access.(sur l'intranet) Existe -t-il une commande ? Merci.