Solved

launch click-once application from another program

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

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…

920 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

13 Experts available now in Live!

Get 1:1 Help Now