Forum Discussion

herbie68nl's avatar
herbie68nl
Occasional Contributor
10 years ago

Can I retrieve the Computername from the System environment

When executing a test I also want to register on witch environment the test was run.

 

So I need the Computername of my machie.

 

Is there a possibility to retrevie this value in VB.

 

I already tried a default solutions as:

Declare Function GetComputerNameA Lib "kernel32" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetComputerName() As String
Dim sResult As String * 255
    GetComputerNameA sResult, 255
    GetComputerName = Left$(sResult, InStr(sResult, Chr$(0)) - 1)
End Function

 

But I cannot Declare Functions in TestComplete.

 

Is there another way to retrieve this kind of System variables