读书人

GetComputerName失败GetLastError回

发布时间: 2013-09-24 11:29:02 作者: rapoo

GetComputerName失败,GetLastError返回111,是什么鬼意思
得不到计算机名,得到1个空字符串。SHIT
[解决办法]
你的输入参数的容量太小了

#define INFO_BUFFER_SIZE 32767
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD bufCharCount = INFO_BUFFER_SIZE;

// Get and display the name of the computer.
bufCharCount = INFO_BUFFER_SIZE;
if( !GetComputerName( infoBuf, &bufCharCount ) )

读书人网 >VC/MFC

热点推荐