Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB
Hello My Dear Friends

I have created an application in C# visual basic 2008, which is starting when System Starts then i am asking for a condition if it is false application get close ..but i want to start my application with an icon on desktop so that user can change the condition required to run application without get closed ........ it means i want to know when user start my application with icon on desktop or start menu.
 
please Help me ...
Posted 18-Nov-12 4:34am
Edited 18-Nov-12 4:48am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Easiest way is give it a parameter, or argument.
If you check in your Main Method (console type apps), or use Environment.GetCommandLineArgs() for winforms, you can read the parameters passed to the application.
 
Set up the System Startup version to have an parameter such as "/Automatic" or similar, and you can detect the startup mode pretty easily.
  Permalink  
Comments
Syed Ghulam Ali at 18-Nov-12 11:04am
   
thankyou for helping me Dear but can u give me a hint code to implement in windows application
OriginalGriff at 18-Nov-12 11:16am
   
Look at the MSDN description of Environment.GetCommandLineArgs:
http://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs.aspx
It gives an example.
Syed Ghulam Ali at 19-Nov-12 5:17am
   
Thanks Dear for helping me ...........
OriginalGriff at 19-Nov-12 5:26am
   
You're welcome!
Espen Harlinn at 19-Nov-12 19:17pm
   
5'ed!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can use my easy-to-use command line parsing library: Enumeration-based Command Line Utility[^].
 
It is complete with full source code and detailed explanation. Two previous articles explaining the techniques are referenced, as well as one alternative (more complex) command line utility.
 
—SA
  Permalink  
Comments
Syed Ghulam Ali at 19-Nov-12 5:19am
   
Thanks Dear for helping me i Got it......and sory for not using ur library but its very effective and even though i had lear a lot from it...
Sergey Alexandrovich Kryukov at 19-Nov-12 11:38am
   
Not too late, but you can simply learn basic ideas...
You are welcome. Are you going to accept the answer formally (green button)? -- thanks.
--SA
Espen Harlinn at 19-Nov-12 19:18pm
   
Well replied :-D
Sergey Alexandrovich Kryukov at 19-Nov-12 19:29pm
   
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,280
1 Sergey Alexandrovich Kryukov 6,059
2 Maciej Los 3,579
3 Peter Leow 3,383
4 CHill60 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100