Solved

Open an application within VB

Posted on 2000-03-30
4
166 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

758 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

17 Experts available now in Live!

Get 1:1 Help Now