VC获取环境变量的方法

2019-04-14 16:45发布

 LPTSTR lpszSystemInfo;     // pointer to system information string 
TCHAR tchUserHome[BUFFER];
 lpszSystemInfo = tchBuffer2;
 DWORD dwResult = ExpandEnvironmentStrings("%OS%", lpszSystemInfo, BUFFER);
 TRACE(lpszSystemInfo);