I'm having a hard time finding a good way to change the name of a computer in C++, both NetBIOS and DNS.
I have found SetComputerNameEx(), but i can't see to get it to work, I am new to C++.
Here is what I have for far.
Code:
typedef enum _COMPUTER_NAME_FORMAT {
ComputerNameNetBIOS,
ComputerNameDnsHostname,
ComputerNameDnsDomain,
ComputerNameDnsFullyQualified,
ComputerNamePhysicalNetBIOS,
ComputerNamePhysicalDnsHostname,
ComputerNamePhysicalDnsDomain,
ComputerNamePhysicalDnsFullyQualified,
ComputerNameMax
} COMPUTER_NAME_FORMAT;
bool WINAPI SetComputerNameEx(COMPUTER_NAME_FORMAT NameType, LPCTSTR lpBuffer);
SetComputerNameEx(ComputerNamePhysicalDnsHostname,"testname");
This is the error I am currently getting which makes no sense to me.
main.cpp||undefined reference to`_Z17SetComputerNameEx21_COMPUTER_NAME_FORMATPKc @8'|
I don't have to use SetComputerNameEx() but it's all I've found so far. Any help and suggestions would be greatly appreciated.
Thanks in advance