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; }