cancel
Showing results for 
Search instead for 
Did you mean: 

Can I retrieve the Computername from the System environment

SOLVED
Highlighted
Occasional Contributor

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

Regards,

Herbert
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Occasional Contributor

Re: Can I retrieve the Computername from the System environment

Hi,

 

You can use HostName property, more about it: https://support.smartbear.com/viewarticle/68025/

 

Kristina

View solution in original post

Highlighted
Moderator

Re: Can I retrieve the Computername from the System environment

Sys.HostName contains the computer name.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

3 REPLIES 3
Highlighted
Occasional Contributor

Re: Can I retrieve the Computername from the System environment

Hi,

 

You can use HostName property, more about it: https://support.smartbear.com/viewarticle/68025/

 

Kristina

View solution in original post

Highlighted
Moderator

Re: Can I retrieve the Computername from the System environment

Sys.HostName contains the computer name.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Highlighted
Occasional Contributor

Re: Can I retrieve the Computername from the System environment

Thank you.

 

Life can be so Simple sometimesSmiley Very Happy, given solutions work perfect

 

Thank you both

Regards,

Herbert
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors