Solved

launch click-once application from another program

Posted on 2007-11-21
4
2,247 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 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