I would advise you to follow the David answer recommendations, but since you need to find a connection:
To check if a file has a link, you can use the built-in FindExecutable function, which is mainly used by Windows Explorer. it gives a good error code ( SE_ERR_NOASSOC ) if there is no connection. After success, it gives the path to the corresponding executable file.
Those DllImport for him
[DllImport("shell32.dll")] static extern int FindExecutable(string lpFile, string lpDirectory, [Out] StringBuilder lpResult);
Another option is, for example, to walk through the registry (not recommended, since it is complicated due to several aspets, such as WoW64, etc.):
The actual association is stored in the key that HKEY_CLASSES_ROOT\.pdf points to - in my case, AcroExch.Document , so we check HKEY_CLASSES_ROOT\AcroExch.Document . There you can see (and change) which command will be used to run this file type:
HKEY_CLASSES_ROOT\AcroExch.Document\shell\open\command
Yahia Mar 02 2018-12-12T00: 00Z
source share