473,813 Members | 2,802 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Start program distributed with one click install

I have an application that I have distributed using one click install. I
selected the option to allow the program to be run if the server is offline.
From another program I want to be able to check if the first program is
running (easy enough) and start it (not so easy) if it is not running. The
shortcut that is created in the start menu is an application reference. My
question is, how do I replicate the function of the application reference
shortcut in my C# program to start the first program?
Thanks,

Tim
Jun 27 '08 #1
2 3073
On Apr 29, 12:09 pm, "Tim Kelley" <tkel...@compan y.comwrote:
I have an application that I have distributed using one click install. I
selected the option to allow the program to be run if the server is offline.
From another program I want to be able to check if the first program is
running (easy enough) and start it (not so easy) if it is not running. The
shortcut that is created in the start menu is an application reference. My
question is, how do I replicate the function of the application reference
shortcut in my C# program to start the first program?
Thanks,

Tim
If i have understood you correctly.
private void StartApplicatio n()
{

string executablePath =
Path.Combine(Se ttings.Default. DestinationPath ,
Settings.Defaul t.ApplicationEx ecutable);

ProcessStartInf o applicationStar tInfo = new
ProcessStartInf o(executablePat h);

Process.Start(a pplicationStart Info);
}
/// I havent used this yet..
void CheckProcess()
{
Process[] processes =
Process.GetProc essesByName(Set tings.Default.A pplicationExecu table);

if (processes.Leng th 1)
{

}
}
Jun 27 '08 #2
The shortcut points at the appref-ms file. If you point it at the exe, it
will not be running as a ClickOnce application.

This is how you create a shortcut on your desktop. Look through this and see
how it creates the .appref-ms shortcut; that's what you want to call.

/// <summary>
/// This will create a Application Reference file on the users desktop
/// if they do not already have one when the program is loaded.
/// Check for them running the deployed version before doing this,
/// so it doesn't kick it when you're running it from Visual Studio.
/// </summary
static void CheckForShortcu t()
{
if
(System.Deploym ent.Application .ApplicationDep loyment.IsNetwo rkDeployed)
{
ApplicationDepl oyment ad = ApplicationDepl oyment.CurrentD eployment;
if (ad.IsFirstRun) //first time user has run the app
{
Assembly code = Assembly.GetExe cutingAssembly( );
string company = string.Empty;
string description = string.Empty;
if (Attribute.IsDe fined(code,
typeof(Assembly CompanyAttribut e)))
{
AssemblyCompany Attribute ascompany =
(AssemblyCompan yAttribute)Attr ibute.GetCustom Attribute(code,
typeof(Assembly CompanyAttribut e));
company = ascompany.Compa ny;
}
if (Attribute.IsDe fined(code,
typeof(Assembly DescriptionAttr ibute)))
{
AssemblyDescrip tionAttribute asdescription =
(AssemblyDescri ptionAttribute) Attribute.GetCu stomAttribute(c ode,
typeof(Assembly DescriptionAttr ibute));
description = asdescription.D escription;
}
if (company != string.Empty && description != string.Empty)
{
string desktopPath = string.Empty;
desktopPath =
string.Concat(E nvironment.GetF olderPath(Envir onment.SpecialF older.Desktop),
"\\", description, ".appref-ms");
string shortcutName = string.Empty;
shortcutName =
string.Concat(E nvironment.GetF olderPath(Envir onment.SpecialF older.Programs) ,
"\\", company, "\\", description, ".appref-ms");
System.IO.File. Copy(shortcutNa me, desktopPath,tru e);
}
}
}
}

Hope this helps.
RobinS.
GoldMail.com
-------------------------------------

"Tim Kelley" <tk*****@compan y.comwrote in message
news:e7******** *****@TK2MSFTNG P02.phx.gbl...
>I have an application that I have distributed using one click install. I
selected the option to allow the program to be run if the server is
offline. From another program I want to be able to check if the first
program is running (easy enough) and start it (not so easy) if it is not
running. The shortcut that is created in the start menu is an application
reference. My question is, how do I replicate the function of the
application reference shortcut in my C# program to start the first program?
Thanks,

Tim
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1443
by: Zak | last post by:
Hello, I am having a problem with a program. I compile the program using VC++ pro. I use "depends.exe" to determine what DLLs the program is linking. Then I use the Install Shield that comes with VC++ to create a setup file. I run the setup file on my pc and it works great. My problem is that when I try to install it on any* other system, the install goes fine but when I try o run the program Nothing happens. I double click and I...
2
21920
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be successful. I'm now ready to start my service (I think) but the NET START command does not appear to indicate that the service is available to be run. The output for NET START is below as well. The Services list in the W2K administrator...
6
1503
by: Zak | last post by:
I compiled a program using VC++ pro. I use "depends.exe" to determine what DLLs the program is linking. Then I use the Install Shield that comes with VC++ to create a setup file. I run the setup file on my pc(XP) and it works great. My problem is that when I try to install it on any* other system, the install goes fine but when I try o run the program Nothing happens. I double click and I don't see an error, the thing just doesn't do...
7
1816
by: Mike | last post by:
So, I've been trying to do "MyFirstVBWebApp" and I am hitting numerous roadblocks. After much google'ing, here is what I have done (XP Pro SP1, IIS 5.1) 1. Uninstalled IIS 2. renamed the existing inetpub directory 3. Started the Distributed Transaction Coordinator 4. Reinstall IIS 5. regsvr32 (v1.1.4322)\aspnet_isapi.dll 6. (v1.1.4322)\aspnet_regiis -i
5
13424
by: SiD` | last post by:
when starting a windows service writte in vb.net, a messagebox appears: cannot start service from the command line or a debugger. A windows service must first be installed using installutil.exe and then startede with the serverexpl, windows services or the NET START command. tryed also installing with installutil: it says there is no install packs. how can I make my service work in design mode and in normal runtime mode?
2
1937
by: | last post by:
I am new to Visual Basic.Net using the Standard Edition, which does not come with a Deployment wizard, so I use the template on the File Systems Tab. Everything works fine, and I have enabled the following (Where "MyProgram.exe" is my new VB,net creation) When the user runs Setup.exe, he is presented with the choice of installing to \Program Files\MyProgram or a location of his choosing. Setup copies all the files to that location,...
1
1299
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I created a setup program using .NET Studio IDE to install my Service. How do I configure it to start up my Service once it finishes installing?
1
4089
by: =?Utf-8?B?SkQ=?= | last post by:
ok, I got a windows xp home edition computer from my friend, it is a custom made one. The windows xp is an OEM product, so microsoft is willing to charge me $59 to tell me how to fix it since its not insured... I searched under Find Error Message on the site and it wasn't there. I get this error message " Error, No Program start menu found." whenever i try to install something onto my computer. I put the disk into the tray, and a window...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10407
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10424
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9224
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7684
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5706
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.