我正在使用SHGetSpecialFolderLocation API 函数。我的应用程序设置为“使用 Unicode 字符集”。
这是我到目前为止所拥有的:
int main ( int, char ** )
{
LPITEMIDLIST pidl;
HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl);
/* Confused at this point */
wstring wstrPath;
wstrPath.resize ( _MAX_PATH );
BOOL f = SHGetPathFromIDList(pidl, wstrPath.c_str () );
/* End confusion */
我得到的错误是:
error C2664: 'SHGetPathFromIDListW' : cannot convert parameter 2 from 'const wchar_t *' to 'LPWSTR'
有人可以帮忙吗?执行此操作的正确 C++ 方法是什么?
谢谢!