Solved

Open an application within VB

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

16 Experts available now in Live!

Get 1:1 Help Now