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
Jessy Sempere [MVP]
Bonjour
Essais ceci :
PC =Environ("ComputerName")
-- @+ Jessy Sempere - Access MVP
------------------------------------ Site @ccess : http://access.jessy.free.fr/ Pour l'efficacité de tous : http://users.skynet.be/mpfa/ ------------------------------------ "steph" a écrit dans le message news: 2093701c4591b$ee366db0$ est il possible en vb de récupérer les informations concernant l'ordinateur surtout le nom de l'ordinateur ? Et comment ?
Merci
Bonjour
Essais ceci :
PC =Environ("ComputerName")
--
@+
Jessy Sempere - Access MVP
news@access.fr.vu
------------------------------------
Site @ccess : http://access.jessy.free.fr/
Pour l'efficacité de tous :
http://users.skynet.be/mpfa/
------------------------------------
"steph" <anonymous@discussions.microsoft.com> a écrit dans le message news:
2093701c4591b$ee366db0$a001280a@phx.gbl...
est il possible en vb de récupérer les informations
concernant l'ordinateur surtout le nom de l'ordinateur ?
Et comment ?
------------------------------------ Site @ccess : http://access.jessy.free.fr/ Pour l'efficacité de tous : http://users.skynet.be/mpfa/ ------------------------------------ "steph" a écrit dans le message news: 2093701c4591b$ee366db0$ est il possible en vb de récupérer les informations concernant l'ordinateur surtout le nom de l'ordinateur ? Et comment ?
Merci
ng
Salut,
Regarde du coté de GetComputerName() :
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerNameAPI Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load() Debug.Print GetComputerName End Sub
Public Function GetComputerName() As String Dim strBuffer As String, lStrLen As Long lStrLen = MAX_COMPUTERNAME_LENGTH + 1 strBuffer = String$(lStrLen, vbNullChar) Call GetComputerNameAPI(strBuffer, lStrLen) GetComputerName = Left$(strBuffer, lStrLen) strBuffer = "" End Function
-- 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/ http://apisvb.europe.webmatrixhosting.net/
steph a écrit :
est il possible en vb de récupérer les informations concernant l'ordinateur surtout le nom de l'ordinateur ? Et comment ?
Merci
Salut,
Regarde du coté de GetComputerName() :
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerNameAPI Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Debug.Print GetComputerName
End Sub
Public Function GetComputerName() As String
Dim strBuffer As String, lStrLen As Long
lStrLen = MAX_COMPUTERNAME_LENGTH + 1
strBuffer = String$(lStrLen, vbNullChar)
Call GetComputerNameAPI(strBuffer, lStrLen)
GetComputerName = Left$(strBuffer, lStrLen)
strBuffer = ""
End Function
--
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/
http://apisvb.europe.webmatrixhosting.net/
steph <anonymous@discussions.microsoft.com> a écrit :
est il possible en vb de récupérer les informations
concernant l'ordinateur surtout le nom de l'ordinateur ?
Et comment ?
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31 Private Declare Function GetComputerNameAPI Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load() Debug.Print GetComputerName End Sub
Public Function GetComputerName() As String Dim strBuffer As String, lStrLen As Long lStrLen = MAX_COMPUTERNAME_LENGTH + 1 strBuffer = String$(lStrLen, vbNullChar) Call GetComputerNameAPI(strBuffer, lStrLen) GetComputerName = Left$(strBuffer, lStrLen) strBuffer = "" End Function
-- 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/ http://apisvb.europe.webmatrixhosting.net/
steph a écrit :
est il possible en vb de récupérer les informations concernant l'ordinateur surtout le nom de l'ordinateur ? Et comment ?
Dans ce cas préfère utiliser Environ$() qui renvoie directement un string :
Dim strName As String strName = Environ$("ComputerName")
Mais personnellement je préfère utiliser les APIs, accordant une confiance limitée aux variables d'environnement...
-- 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/ http://apisvb.europe.webmatrixhosting.net/
a écrit :
PC =Environ("ComputerName")
et ca suffit !
merci quand meme
Salut,
Dans ce cas préfère utiliser Environ$() qui renvoie directement un string :
Dim strName As String
strName = Environ$("ComputerName")
Mais personnellement je préfère utiliser les APIs, accordant une confiance
limitée aux variables d'environnement...
--
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/
http://apisvb.europe.webmatrixhosting.net/
anonymous@discussions.microsoft.com <anonymous@discussions.microsoft.com> a
écrit :
Dans ce cas préfère utiliser Environ$() qui renvoie directement un string :
Dim strName As String strName = Environ$("ComputerName")
Mais personnellement je préfère utiliser les APIs, accordant une confiance limitée aux variables d'environnement...
-- 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/ http://apisvb.europe.webmatrixhosting.net/