Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get ComputerName (adapted from Visual basic Project)
Message
De
14/07/1999 09:21:14
Anderson Girardi
Athenas Automação de Escritório
Porto Alegre, Brésil
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Get ComputerName (adapted from Visual basic Project)
Divers
Thread ID:
00241239
Message ID:
00241239
Vues:
78
hello Dear friends!

I wanna get the computer name, i have a project in Visual Basic that does it, but i´m trying to convert to Visual FoxPro and ai having GPF when i execute it.

The Project in Visual Basic is:

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal sBuffer As String, lSize As Long) As Long

Private Sub Command1_Click()
Dim PCName As String
Dim P As Long
P = NameOfPC(PCName)
Text1.Text = PCName
End Sub

Function NameOfPC(MachineName As String) As Long
Dim NameSize As Long
Dim X As Long
MachineName = Space$(16)
NameSize = Len(MachineName)
X = GetComputerName(MachineName, NameSize)
End Function


And My Visual FoxPro program is:

Declare String GetComputerName In Kernel32
P = NameOfPC()


Procedure NameOfPC
MachineName = " "
NameSize = Len(MachineName)
X = GetComputerName()
Return X

What i´m doing wrong????

Thanks
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform