开发者

Is there any reliable API to Get Windows Folder in Windows?

Is there any reliable API to Get Windows Folder in Windows in C++? I am using the following way, however it failed.

开发者_JS百科    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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜