Click to See Complete Forum and Search --> : How to find Application to Open a .PDF
hinksj
January 11th, 2004, 04:43 PM
I want to _spawn() an application to process a file.
Specifically, i want to spawn the PDF Reader and pass it a PDF file to process.
HKEY_CLASSES_ROOT\.pdf does not provide path information.
I found it on my computer under :
HKEY_CLASSES_ROOT\Applications\AcroRd32.exe.
But that is NOT the case with all my computers (some use Acrobat.exe)
So ... general Question .... given a files EXT, how can an application locate the proper program to spawn() thereby executing it?
Andreas Masur
January 11th, 2004, 04:46 PM
There are several solutions...the easiest would be using 'ShellExecute()/ShellExecuteEx()'...for further information take a look at the following FAQ (http://www.codeguru.com/forum/showthread.php?s=&threadid=231233)...
hinksj
January 11th, 2004, 05:02 PM
Works Great ... thanks.
All I could find was _spawn() and _exec().
msanford
January 13th, 2004, 01:36 PM
a good way to tell what application is regestired given a extension to look in the registry HKEY_CLASSES_ROOT\.ext the following subkey is the is the name of the regesitry key used to launch the program. So then look in HKEY_CLASSES_ROOT\subkey\shel\openl\command so in the case of Acrobat and and .pdf it would look like this:
first find the registered program
HKEY_CLASSES_ROOT\.pdf\AcroExch.Document
now get the command to launch it
HKEY_CLASSES_ROOT\AcroExch.Document\shell\Open\command
wey97
January 13th, 2004, 04:33 PM
Originally posted by msanford
a good way to tell what application is regestired given a extension to look in the registry HKEY_CLASSES_ROOT\.ext the following subkey is the is the name of the regesitry key used to launch the program. So then look in HKEY_CLASSES_ROOT\subkey\shel\openl\command so in the case of Acrobat and and .pdf it would look like this:
first find the registered program
HKEY_CLASSES_ROOT\.pdf\AcroExch.Document
now get the command to launch it
HKEY_CLASSES_ROOT\AcroExch.Document\shell\Open\command
Well if the registry entries are correct then it should have no
problem with ShellExecute which does the work for you.
It's a lot easier than doing the registry work manually.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.