Solved

Open an application within VB

Posted on 2000-03-30
4
170 Views
Last Modified: 2010-05-02
I need to add two buttons to a VB app. These buttons need to open Internet Explorer and Adobe Acrobat. I would like to know is there any way to open their .exe's without giving the total, specific path? I've gotten it to work with the shell command but I need to hard code the entire path to the exe. This is not acceptable in the application since clients could have these particular executables in several locations, depending on the version. Can anyone help?
0
Comment
Question by:danetteh
  • 3
4 Comments
 
LVL 1

Expert Comment

by:tkuppinen
ID: 2669760
Have you tried the shellExecute API?  This function will open specific files with their default program.  So if you pass a .pdf file to this function it will open acrobat and the file associated file, so all you would need is the path to the file.  If you pass a url to this same function it will open the site using the default browser.
0
 
LVL 10

Accepted Solution

by:
caraf_g earned 50 total points
ID: 2669774
Yes, it's possible.

I don't know about Adobe Acrobat, but the principle is the same as for Internet Explorer.

For internet explorer, do the following

1 - in the registry, find key:
HKEY_CLASSES_ROOT\.html
In there you'll find a (default) value. This will contain a value, typically: htmlfile

Use this value to find the next key:
HKEY_CLASSES_ROOT\htmlfile

Take the sub key:
HKEY_CLASSES_ROOT\htmlfile\shell\open\command
The (Default) value in there contains the command that is used, and hence the full path. In my case, for example:

"C:\PROGRA~1\Plus!\MICROS~1\iexplore.exe" -nohome

Et voilá

0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2669777
Check out also the following sample program:

http://homepage.eircom.net/~carafa/VBSamples/VBAll/shellexecute.zip
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2669783
Ah, I think I know... Adobe Acrobat opens .pdf files, right?

So find
HKEY_CLASSES_ROOT\.pdf
instead of
HKEY_CLASSES_ROOT\.html

And continue in a similar fashion to .html

etcetera...
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now