Solved

Open an application within VB

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

710 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