Using Adobe Acrobat to open a .PDF
-
Hi, I am using the Windows API to write some code that uses the end user's already installed Adobe Acrobat Reader to open up a *.PDF file. My problem is locating the file. Everytime Adobe upgrades to another version of Adobe Acrobat the pathname changes, say for example from C:\Program Files\Adobe\Acrobat 5.0\Reader\Acrord32.exe to C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.exe which at the moment causes the routine to fail unless I have specified the correct directory. I am guessing there must be a much better way to do this, could anybody point me in the right direction? I would assume that you can ask the operating system what *.exe it uses to open up *.pdf and tell it to use that, but I am unsure how I code that. Could someone point me in the right direction? Thanks, Joe
-
Hi, I am using the Windows API to write some code that uses the end user's already installed Adobe Acrobat Reader to open up a *.PDF file. My problem is locating the file. Everytime Adobe upgrades to another version of Adobe Acrobat the pathname changes, say for example from C:\Program Files\Adobe\Acrobat 5.0\Reader\Acrord32.exe to C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.exe which at the moment causes the routine to fail unless I have specified the correct directory. I am guessing there must be a much better way to do this, could anybody point me in the right direction? I would assume that you can ask the operating system what *.exe it uses to open up *.pdf and tell it to use that, but I am unsure how I code that. Could someone point me in the right direction? Thanks, Joe
You can call
ShellExecute
using as argument the path of the document to open (instead of that of the executable, see MSDN documentation for details...). hope that helps. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Hi, I am using the Windows API to write some code that uses the end user's already installed Adobe Acrobat Reader to open up a *.PDF file. My problem is locating the file. Everytime Adobe upgrades to another version of Adobe Acrobat the pathname changes, say for example from C:\Program Files\Adobe\Acrobat 5.0\Reader\Acrord32.exe to C:\Program Files\Adobe\Acrobat 7.0\Reader\Acrord32.exe which at the moment causes the routine to fail unless I have specified the correct directory. I am guessing there must be a much better way to do this, could anybody point me in the right direction? I would assume that you can ask the operating system what *.exe it uses to open up *.pdf and tell it to use that, but I am unsure how I code that. Could someone point me in the right direction? Thanks, Joe
TheDelChop wrote:
I am guessing there must be a much better way to do this, could anybody point me in the right direction? I would assume that you can ask the operating system what *.exe it uses to open up *.pdf and tell it to use that, but I am unsure how I code that.
http://visualcpp.org/template_permalink.asp?id=125[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you