• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3303
  • Last Modified:

Change the default PDF reader programmatically

I'm wondering if it is possible to programmatically change the default PDF reader in Windows 2000/XP/Vista.

For example, if the default reader was Foxit, could an application that sends Adobe-style "Open Parameters" ( see http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf ) change the default reader to Adobe?

Whether or not Adobe is installed is another issue I'm not concerned with at this time.

If it is possible I don't need all the gory details, but I do need enough information so I can write sufficiently detailed instructions for a developer.

I'm hoping it's as simple as Registry edit.

TIA.
0
Soporose
Asked:
Soporose
  • 2
1 Solution
 
scrathcyboyCommented:
"Whether or not Adobe is installed is another issue I'm not concerned with at this time"

You are asking an unsolvable rhetorical question.  YES, you can setup any .REG file to change the registry settings, I can give you dozens of examples if you want.

However, as soon as anyone installs Adobe software on their machine, the Adobe install is going to overwrite those registry settings with the same kind of .REG file that you or anyone else can create.

So let me ask you, what is the point of setting REG settings when there is no app to handle them, if upon installation of the app that CAN handle them, it is going to change your registry settings anyway???

Did I miss something?
0
 
SoporoseAuthor Commented:
Hi scrathcyboy (with the 'c' and 'h' transposed???)

When I said I'm not concerned with it at this time, I didn't mean the fact of its existence (or not) would be completely ignored. It's a separate issue that will be addressed separately.

My thinking is that some action will be taken to determine if the Adobe reader is installed, and I don't see that task as posing a problem.

If the Adobe reader isn't installed then some intervening action will have to be taken (a warning or whatever). Obviously there would be no point in writing the Adobe registry values if the Adobe reader wasn't installed, because it still wouldn't work anyway, so nothing gained.

For the purpose of this question I'm just assuming that the Adobe reader is installed, but that it is not the default reader.

It's not absolutely essential to know what reader IS the default, although that would be nice as it would be user-friendly to programmatically change back again when finished with the Adobe reader.

Sometimes registry entries are cross-referenced all over the place, so I'm looking for knowledgeable and expert input rather than try to chase it down myself. I'm an IT consultant (retired to do other things) and can "dabble" in a wide range of stuff, but I don't have programmer-level expertise with the registry, APIs, etc. In other words this is a bit out of my league, but I'm quite capable of writing detailed requirements and instructions once I've got the necessary raw data.

Ideally I will be able to find out:

1. What is the current default reader?

2. How to make the Adobe reader the default?

3. How to return default status to the original reader?

Sorry if I wasn't clear in the first instance.
0
 
scrathcyboyCommented:
yes, the transposition was a result of typing too fast, an initial blooper that I have had to live with.

OK, that makes a whole lot more sense.  Here are the registry keys you are looking for, the assumption here is that the default reader you are looking for is for the .PDF file handling.

HKEY_CLASSES_ROOT\.pdf  -- the link to the PDF opening
HKEY_CLASSES_ROOT\AcroExch.Document\shell\open\command -- acrobat exchange reader file open
HKEY_CLASSES_ROOT\PDF.PdfCtrl.5\CLSID  -- this is the link to the PDF control, in the CLSID list
HKEY_CLASSES_ROOT\CLSID\{CA8A9780-280D-11CF-A24D-444553540000}\InprocServer32  -- this is the active-x link for the PDF control default type, as installed by adobe.
HKEY_CLASSES_ROOT\Mime\Database\Content Type\application/pdf  -- a link to the same PDF handler
HKEY_CLASSES_ROOT\Software\Adobe\Acrobat\Exe  -- main link to the installed program version

And there are about 20 other keys with links to the adobe acrobat installation for PDF.  If you want to test how a PDF is being opened, you test the first key for a valid entry, if you want to find the version of acrobat handling PDF files, you test the last key for version number and name.

If you want to override these defaults, you just create a .REG file with the right information for that key and run the .REG by right clicking and choosing, "merge with registry".  It has to be done on a one by one basis, unless you have a server with complex scripting to push the updates to the clients.

If you want to change the default handler manually, of course, it is windows explorer, options, file types tab, scroll to the .PDF entry, and then choose to restore to original, or manually insert the correct reader.

Of course the automated way to do this is to remove the old reader and install a new one.  How you would programmatically try to recreate all these adobe entries, at least 25 of them, is to run the adobe install up to a point where the files are extracted to the hard disk, then stop it, and look for the file that adds the registry entries, and debug that file until you get all the registry keys that the install will change.

Hope that gives you an idea of what you are up against, it is a massive undertaking to recreate an install that took a large company like adobe years to generate.


I heard that Qld has had a lot of flooding lately.  I hope while you are typing that at least your keyboard is above the water line, otherwise you could get quite a shock at receiving this message  !!  Cheers.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now