Solved

launch click-once application from another program

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

763 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

10 Experts available now in Live!

Get 1:1 Help Now