August 5th, 2003, 09:49 AM
Is there any way to get the name of the computer in C++.
I need to obtain the local computers name for a C++ program I am converting from VB. This is how the VB program did it.
Set WN = CreateObject("Wscript.Network")
transfilename = WN.ComputerName
outfilename = WinPath & transfilename
Is there any way C++ can do this? All I need is the computers name.
August 5th, 2003, 10:15 AM
Never mind I figured it out.
August 27th, 2003, 03:02 AM
Re: Is there any way to get the name of the computer in C++.
Of course, what you do in VB is just a wrapper of the Windows API which is written in C. There is all you need in the API. In fact VB can't do things that the API can't do. VB is just a wrapper, So there is such a function and it is very simple:
DWORD dwSize = MAX_COMPUTERNAME_LENGTH+1;