I'm trying to retrieve the name of the computer that my programm is running on. This is the code:

TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; 
  DWORD cnt = MAX_COMPUTERNAME_LENGTH + 1;
  std::string name = "";
 if( GetComputerName( compName, &cnt) )
  {
    name = compName;
  }
 return name;

The compiler comes up with this error:
Error C2660: 'GetComputerNameA' : function does not take 2 arguments.

Does anyone has an idea ??

Grtz,

Recommended Answers

All 2 Replies

You must have another function in your program called GetComputerName(). Your code snippet compiled without error in a simple test program that only contains a main() function.

Stupid, stupid, stupid :confused: :confused: :sad: :sad:

Thanks Ancient Dragon...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.