I'm using the SHGetSpecialFolderLocation API function. My application is set to "Use Unicode Character Set".
Here's what I have so far:
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 */
The error I'm getting is:
error C2664: 'SHGetPathFromIDListW' : cannot convert parameter 2 from 'const wchar_t *' to 'LPWSTR'
Can someone help? What's the proper C++ way to do this?
Thanks!
SHGetSpecialFolderLocation/SHGetSpecialFolderPathis obsolete. Microsoft suggestsSHGetKnownFolderPath(msdn.microsoft.com/en-us/library/bb762188.aspx), or, if you want to stay compatible with Windows XP,SHGetFolderPath(msdn.microsoft.com/en-us/library/bb762181.aspx).