Link to home
Start Free TrialLog in
Avatar of jack niekerk
jack niekerkFlag for Netherlands

asked on

NEED TO FIND PATH/LOCATION TO INSTALLED ADOBE READER

If a PDF file exist (wich I check first)  I can open the file in VB6 by using:

Shell "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe J:\PDS_PDF_FILES\" & Trim(Artikelnr.Text) & ".PDF", vbMaximizedFocus

But, this is when I know where on a station the user did install his adobe/version/reader, that I will not know for allways, if I install form distance my program
Is there a way to find for any workstation the location (if installed)  for the adobe program,  before performing the shell, so it will find it?
Avatar of GPrentice00
GPrentice00


Check the registry for the folowing key:
HKEY_CLASSES_ROOT\Applications\AcroRD32.exe\shell\Read\command

having the "(DEFAULT) key" value in my computer be
"E:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" "%1"

You just need to add some registry-reading code to the program (found many places), read the key value, and parse it out..

--
The pdf file should also be registered if a reader does exist, perhaps adobe not the default for the system. But because it is registered, another fast and simple trick would be to have explorer.exe open the file as it would when you click a pdf file:
The following shelled commandline works in a test on my system with a testfile.pdf document in the C:\ folder, opening up the pdf document:

explorer.exe c:\testfile.pdf

explorer.exe doesn't require a path specifier, although %windir%\explorer.exe would be the best path specifier to use...
If your pdf filename does/might contain spaces or other special characters, make sure to wrap the file pathname-filename in quotes as well

Good luck



Avatar of jack niekerk

ASKER

True , I was doing this
Shell   "explorer " & "J:\pdf\" & Trim(Artikelnr.Text) & ".PDF", vbMaximizedFocus
But this will give me a popup with text:
In header:  Downloading file,
In text box:
Name:  230-01-222.pdf
Type:  Unknown filetype, 28.9 kb
Off:  J:\pdf
                         Save,    Abort ?
If I do a save-click  it will say "exist, overwrite?"
If I conform then after that it opens explorer window, showing "saved"file , then I can click on it , then adobe opens it

If I do:  Shell "explorer " & "J:\pdf\", vbMaximizedFocus
It will give me the directory ,  but all pdf files instead off focussed to the one asked
So I have to jump in your advise to keep going the direct way.
Thanks
Jack





So that is/was the reason for going the requested way, by calling the program Adobe itself

Interesting... as if downloading it.

Then calling up its location from the registry would be the only alternative then
Hi, I did download some utils to read registry keys,  I was not able , due to not knowing how to format a call to these utils , to extract what I need as you suggested, sorry feel a bit dumm.
okay, I did a bit of hunting on the net because I couldn't find my library example code from wayback, and found the walkthrough on using APIs to read the registry on the microsoft knowledgebase
I started with that, tweaked it a bit in order to read the right keys, then went back and custom-wrote new functions to bypass all of its multi-functional-multi-type features to simplify it for a string-value registry key only.
I would however recommend taking a look at the page and maybe getting all of the code for your own library in case that article disappears one day soon, its pretty powerful tool to pack into your personal code library, and if you want to read non-string values for other keys...

I stripped most of the code down, leaving only the applicable hkey_ and error constants and removing all of the multi-function and writing-to-registry functions, to produce a "read me a string value from anywhere in the registry" only system.

I will post the code momentarily
ASKER CERTIFIED SOLUTION
Avatar of GPrentice00
GPrentice00

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes, this does the job!,  great and thanks
Regards Jack