|
-
June 11th, 2002, 10:22 PM
#1
How to get server name for local machine?
Hi,
Is there another way other than API gethostname to get server name for local machine?
I have to link wsock32.lib in order to use that API. Then, my app will become more fat.
Thank you.
-
June 11th, 2002, 11:10 PM
#2
you can load wsock32.dll with LoadLibrary() and then call to gethostname with GetProcAddress()
or try getenv( "COMPUTERNAME" );
-
June 12th, 2002, 07:30 AM
#3
Use the following code:
TCHAR m_szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwNameSize = MAX_COMPUTERNAME_LENGTH + 1;
::GetComputerName (m_szComputerName, &dwNameSize);
Works every time
-
June 12th, 2002, 07:48 PM
#4
Yes.Use this API getComputerName().
Yes, I use this API getComputerName(). Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|