[英]Is there any reliable API to Get Windows Folder in Windows?
Is there any reliable API to Get Windows Folder in Windows in C++? 是否有可靠的API在C ++中的Windows中获取Windows文件夹? I am using the following way, however it failed.
我正在使用以下方式,但是失败了。
BOOL CQUserInfoHelper::GetWindowsPath(CString& strWindowsPath)
{
TCHAR windowsPathTemp[MAX_PATH];
int nSize = MAX_PATH;
::GetWindowsDirectory(
windowsPathTemp,
nSize);
strWindowsPath = windowsPathTemp;
return TRUE;
}
Try This - 尝试这个 -
const DWORD dwBufferLength = 65537;
CStringW strBuffer;
if (!::GetCurrentDirectory( dwBufferLength ,
strBuffer.GetBuffer(dwBufferLength)) )
return L"";
... ...
strBuffer.ReleaseBuffer();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.