Hello,
I want open a file with an xdp-extention with the default program for a pdf-file.
I can't change the default program to open an xdp-file because that has stay another program (designing program)
So if i dubbelclick the xdp-file it has to open in the designer (default from installation) but if I open the file from my program (shellexecute) I want to open it with the default pdf-program.
Most of the time this will be a version of Acrobat but it can be another one.
Problems:
I never know for sure what version of Acrobat the users have.
I looked in the registry to find out how windows opens a pdf-file by default and I think its the following
if I look at HKLM\SOFTWARE\Classes\.pdf I see the default is Acroexch.Document
then I get the command from HKLM\SOFTWARE\Classes\AcroExch.Document\Shell\open\command
Now if i use that key in the shellexecute everything works fine! But I'm not sure that this is the best way to get the default pdf-program.
I'm afraid that this will only work if the default program to open pdf-files is Acrobat (because AcroExch.Document makes me a little bit suspicious).
Does anyone knows how to use the users default program to open a pdf-file and use that command (not hardcoded) to open another file-type that has another default program.
NB: at the moment everything works fine but I wonder what will happen if the user has another default for opening pdf-files
Regards
Didier
Test it
Have you tried changing the open command to another program and retested?
If you change the Open command, what keys remain/appear in the registry?
Test results
Hello Niek,
I've installed PDFX-viewer (portable version) and changed the default for opening PDF-files to that program.
When I look to the registry I see that my sollution will not work because it's still
HKLM\SOFTWARE\Classes\.pdf = Acroexch.Document
HKLM\SOFTWARE\Classes\AcroExch.Document\Shell\open\command
So my program will still open a pdf-file with Adobe, that's what I thougt it would be but not what I would like it would be
Now if I look deeper in the registry I notice that I can use the following:
HKCU\software\Microsoft\windows\currentversion\explorer\fileexts\.pdf has a new key 'Application' whith the value 'PDFXCview.exe'. That key doesn't exists if the default pdf-open program is Adobe.
So maybe what I can do is:
Look at HKCU\software\Microsoft\windows\currentversion\explorer\fileexts\.pdf\Application
If that key exists then
I have to find HKCU\Software\classes\Applications\PDFXCview.exe\shell\open\command
else
i have to find
HKLM\SOFTWARE\Classes\.pdf = Acroexch.Document
HKLM\SOFTWARE\Classes\AcroExch.Document\Shell\open\command
Do you think that this is the right way or do you know a better way to achive this
Regards
Dujardin Didier
Xpower nv
Don't know if there is
Don't know if there is better way.