0

I want to know if there is a specific entry to check in the registry to see if there is a default program associated with a specific file type?

My main example would be a PDF. Documentation in my company is mainly PDF. We want to be able to distribute the latest Adobe Reader because, generally, a lot of the PCs using my company's software will not have access to the internet.

During installation, I want to be able to check if the computer we are installing on already has a program to view PDF files. If yes, carry on. if not, then run the Adobe distribution as part of the install.

I'm focused on Windows 7 PCs, registry entry(ies) I can read programatically to see if, as an example, PDF has a valid program to open it.

2 Answers 2

1

No this option not exists. Although HKCR\'PROGID'\shell\open may points to the installed software.

User MC ND have wrong answer. See my screenshot:

enter image description here

During installation, I want to be able to check if the computer we are installing on already has a program to view PDF files. If yes, carry on. if not, then run the Adobe distribution as part of the install.

So I have pdf reader (!!!) with no associations. MC ND you are still thinks, I have no pdf reader?

Sign up to request clarification or add additional context in comments.

3 Comments

You have a pdf viewer. Or not. What you are showing in your screenshot depends on data stored under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithList, and show the list of the programs that have been used to open pdfs. And they are not required to stay in the system. And you can have the viewer, not executed it and it will not appear under this registry key. assoc is not "the truth", it is just a easy way to ask the OS if it knows how to handle the file.
No, you are not right, user is ask if is possible determine if any pdf viewer is installed, read carefully. Again what if never open pdf file (or never associate), but have pdf viewer??? And I executed many times Sumatra, but not associate this, so you dont know, what you talk!!!
Maybe i'm not right. I've never said i was. I saw How to tell if a specific file extension has a default program to open it? and thinked "Hey, the OS is friendly enough to answer to it when asked. Let's go ask." Sure next time i will read better.
-1

From console

assoc .pdf to get the "fileType" associated to the extension. Once you have the fileType (ex. AcroExch.Document.11):

ftype AcroExch.Document.11 to get the associated program.

5 Comments

Thanks. Would you know of a way to call these commands from an Inno Setup script?
@ChrisJ, not sure (not my field, but..) may be this could work Exec(ExpandConstant('{cmd}'), '/c "assoc .pdf"', '', SW_HIDE,ewWaitUntilTerminated, ResultCode); If ResultCode is 0, the extension is associated. If it is 1 there is no association.
AcroExch.Document.11 is not FileType, but ProgID.
I created own format .FFF, which is simple text file. Run notepad, wordpad, or another text editor. :-) Open .FFF file. Eureka, I open this file, but wait! You wrote, that assoc command told us, if we have associated to the extension. Running cmd, wrote assoc .FFF. Hmmm we have not the associated program, because, answer is blank. So we not have "default" program to open .FFF file, nor program to open file, hence downvote.
@user2120666, you are right, it is a progid, but from the assoc command point of view it is a FileType. And yes, you can open your .FFF file using any adequate tool, but the system (not the user) has no information about what to do with that file, there is not any default program to handle it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.