Solved

launch click-once application from another program

Posted on 2007-11-21
4
2,249 Views
Last Modified: 2013-11-26
I am trying to determine how to launch a VB.NET application which was installed using Click-Once deployment from another application.  Thus far, the only relevant information I have been able to find was in the following article:

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_22746601.html?sfQueryTermInfo=1+%22click+onc%22+anoth+applic+from+open+program

However, when using the method shown there the application does not open but instead tries to install itself again.  

I need to know how to open the Click-Once application from other programs as it is part of an inter-related group of programs I have been developing.
0
Comment
Question by:iscontact
  • 3
4 Comments
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 500 total points
ID: 20336445
When an application is installed, the installer may or may not remain on the pc. In most cases, it is not needed to run the application.

So, for the time being, ignore the installer.

Instead, look at the shortcuts produced by the installation procedure. Normally these will end up on 1 of 2 places - your start menu or the "all users" start menu.

If you go to a command prompt and type SET and then press enter, you will see environment variables such as ...

ALLUSERSPROFILE
USERPROFILE

These point to the directories responsible for holding the profiles.

So, looking for the location of say, Internet Explorer (Start | All Programs | Internet Explorer) you would look for the shortcut in ...

"%USERPROFILE%\Start Menu\Programs\Internet Explorer.lnk"

So, running this program via an appropriate shell exec type command, will run the program.

You can even pass parameters!

Type this at the command prompt (all 1 line) ...

"%USERPROFILE%\Start Menu\Programs\Internet Explorer.lnk" http://tinyurl.com/3avvyp

So, something like this should work ...

Shell("""%USERPROFILE%\Start Menu\Programs\Internet Explorer.lnk"" http://tinyurl.com/3avvyp", vbMaximizedFocus)

I'm no VB expert, so I you may need to play with the exact syntax.

Of course, if you don't find the lnk you want in USERPROFILE, then you will need to look in ALLUSERSPROFILE.

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 20336462
http://msdn2.microsoft.com/en-us/library/142dbbz4(VS.80).aspx

"The application is added to the user's Start menu and to the Add/Remove Programs group in the Control Panel. Unlike other deployment technologies, nothing is added to the Program Files folder, the registry, or the desktop, and no administrative rights are required for installation"

So, only the shortcut to the program is possible.  But it suggests that every time the program is launched it is installed temporarily.
0
 

Author Comment

by:iscontact
ID: 20352637
Thanks for the help.  This helped me to get the application to launch.  For reference, the command line I used is as follows:

Dim runningProc As System.Diagnostics.Process
runningProc = New System.Diagnostics.Process

'Do not receive an event when the process exists
runningProc.EnableRaisingEvents = False

runningProc.Start("c:\Documents and Settings\" & UserName & "\Start Menu\AppName.appref-ms")

Note that the link is actually an application reference and not a link.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 20356346
Yes, if the shortcut is to, say, an Excel spreadsheet or a bat file or anything that is either a "program" or has an extension which is registered with a program, then running it via the shell executor will do the job.

I'm unsure why you are using System.Diagnostics.Process, it doesn't "sound" like the sort of thing to run a program, but I'm not VB.NET expert ...

Glad to have helped!
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb message driven bean mdb creation steps 2 34
How to Have Macro Files Automatically "Edit" 5 47
UDP Data Capture Thread Issue 7 30
CSV file copy field 1 to field 2 2 36
A short article about problems I had with the new location API and permissions in Marshmallow
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

756 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