C++判断安装系统的盘符

发布时间 2023-04-21 13:48:26作者: 远方是什么样子

 

wstring getWindowsDirectory()
{
    wstring wstr;
    UINT size=GetWindowsDirectory(NULL,0);
    wchar_t *path=new wchar_t[size];
    if(GetWindowsDirectory(path,size)!=0) //函数调用失败将返回0
    {
        wstr=path;
    }
    delete [] path;
    return wstr;
}