Solved

Open an application within VB

Posted on 2000-03-30
4
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

622 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