为什么VC6.0的Release 和Debug两个版本的执行结果不一样???
BOOL GetComputName()
{
HKEY hKey;
DWORD dwType, dwSize;
if(RegOpenKeyEx (HKEY_LOCAL_MACHINE,"System\\currentControlSet\\Control",0,Code1_KEY_ALL_ACCESS,&hKey) == ERROR_SUCCESS)
{
if(RegQueryValueEx (hKey, "Current User", 0, &dwType, (LPBYTE)&Global.szComputerName, &dwSize) != ERROR_SUCCESS)
{
MessageBox(NULL, "Can't find Current User!", "NG", 0);
return FALSE;
}
}
else
{
MessageBox(NULL, "Can't open REG", "NG", 0);
RegCloseKey(hKey);
}
return TRUE;
}Release :可以的到用户名,
Debug:不能得到用户名
请各位高手帮忙解决。谢谢!