const MAX_COMPUTERNAME_LENGTH = 15
declare function GetComputerName lib "kernel32.dll" alias "GetComputerNameA"
(lpBuffer$, nSize as pointer to long) as long
declare function SetComputerName lib "kernel32.dll" alias "SetComputerNameA"
(lpComputerName$) as long
declare function GetUserName lib "advapi32.dll" alias "GetUserNameA"
(lpBuffer$, nSize as pointer to long) as long
and here is part of a subroutine that will get the computer name for you.
Sub TestBegin
dim lRetVal as long ' for return code of function
dim lSize as long ' for get computer name call
dim ptrlSize as pointer to long ' for get computer name call
global g_strComputerName as string
ViewPort Clear ' clear the viewport if running under
' ms dev studio
' this is our global variable to tell us what directory the application is
installed to...filled from xxxxx.ini
g_strTpnetDir = SPACE$(129) ' fill it full of spaces then null terminate
that string
g_strTpnetDir = g_strTpnetDir + CHR$(0)
' put the application directory from the xxxxxx.ini into our global variable '**************************************************** lSize = 128 ' assign length of name ' call to GetComputerName requires a null terminated string ' this will update our global computer name variable Good luck Martin Fensome
lRetVal =
GetPrivateProfileString("Setup","TPWinRoot","C:\APPDIR",g_strTpnetDir,lenb(
_strTpnetDir),"XXXXX.INI")
ptrlSize = VARPTR(lSize) ' assign address of lSize to variable
g_strComputerName = SPACE$(lSize -1) ' return a string of spaces
g_strComputerName = g_strComputerName+CHR$(0) ' null terminate that string
GetComputerName(g_strComputerName,ptrlSize)
'****************************************************
> machine name. I know that this can be done with a API call, but I do
> not see a way to do this in the visual test language. Does anyone
> know if and to what extent that VT supports API calls.
1. Upgrade Visual Basic 3.0 to Visual Basic 6.0 or Visual Basic.NET
Hi
is anyone having an idea of any kind of tools to migrate
VB3.0 code to VB 6.0 or VB.NET. Pl. let me know.
3. Visual Test 6 and Visual Basic 6 Application Testing
4. basic stamp II -> H-Brige with sensor
5. Visual Basic, Visual Basic for Applications, MindWrapBasic, Sax Basic?
7. Visual Test and Visual Basic interaction; is this possible ?
8. Germany: Second Progress Report by the Federal Government [Part 1]
9. Visual Basic with Visual Test
10. Reading PDF Field Properties in Visual Basic using Adobe's SDK
11. Software QA - Using SQA Team Test & Visual Basic