Cum aflu executabilul asociat unei extensii (".txt", ".doc", ".xls" etc)?
Raspuns
Simplu, folosind functia AssocQueryString.
Exemplu
Code: Select all
#include <shlwapi.h>
#include <tchar.h>
#pragma comment(lib, "shlwapi.lib")
//...
LPCTSTR pszExtension = _T(".xls");
DWORD dwSize = _MAX_PATH + 1;
TCHAR pszAssocExe[_MAX_PATH + 1] = {0};
//...
HRESULT hr = ::AssocQueryString(0, ASSOCSTR_EXECUTABLE,
pszExtension, _T("open"), pszAssocExe, &dwSize);
if(SUCCEEDED(hr))
{
// Enjoy of pszAssocExe.
}
//...
<< Back to Windows API Index