I'm developing a replacement for IFileOpenDialog
and IFileSaveDialog
.
I almost have it working (at least IFileOpenDialog
), but when I want to return the IShellItem
that represents the new filename (that the user has choosen to save in the GetResult()
method), I can't get SHParseDisplayName
working with this new filename. I always receive an error "The system cannot find the file specified"
.
I will appreciate some examples or another solution maybe to my problem.
Edit:
HRESULT CFileSaveDialogProxy::GetResult( __RPC__deref_out_opt IShellItem **ppsi)
{
//return m_Original->GetResult(ppsi);
WCHAR pszPath[MAX_PATH] = {0};
HRESULT hr = ERROR_CANCELLED;
if (m_SelectedFiles.size() > 0)
{
QString s = m_SelectedFiles.at(0);
s.replace(QString("/"),QString("\\"));
s.toWCharArray(pszPath);
//PCIDLIST_ABSOLUTE pIdL = ILCreateFromPath(pszPath);
PIDLIST_ABSOLUTE pIdL = NULL;
SFGAOF out;
hr = SHParseDisplayName(pszPath,NULL,&pIdL,SFGAO_FILESYSTEM,&out);
if (SUCCEEDED(hr))
{
hr = SHCreateItemFromIDList(pIdL, IID_PPV_ARGS(ppsi));
}
}
return hr;
}