Get the associated program from a type of file.

Get the associated program from a type of file.

AssocQueryString

See version :

Pas de dépendances

Download :

#include <shlwapi.h>
#include <stdio.h>
#include <tchar.h>

#pragma comment(lib,"shlwapi.lib")

int main(void)
{
    TCHAR szPath[MAX_PATH];
    DWORD dwSize = sizeof szPath;
    if (AssocQueryString(0, ASSOCSTR_EXECUTABLE, _T("http"), _T("open"), szPath, &dwSize)==S_OK)
        _tprintf(_T("%s\n"),szPath);
    if (AssocQueryString(0, ASSOCSTR_EXECUTABLE, _T(".html"), _T("open"), szPath, &dwSize)==S_OK)
        _tprintf(_T("%s\n"),szPath);
    if (AssocQueryString(0, ASSOCSTR_EXECUTABLE, _T(".mp3"), _T("open"), szPath, &dwSize)==S_OK)
        _tprintf(_T("%s\n"),szPath);
    return 0;
}



Explanations

	No explanations yet.