Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello all. Let's say 10 desktop shortcuts, all with different names/icons, point to and can start the same exe application from the same directory. Is there any means for the application, after it is started, to know or to discover the distinct name of the shortcut that was doubled_clicked and started this application? Also is there in general any means for a running application to know if it was started by command line, by a double_click on the exe, by a double_click on a shortcut that points to it, or by another process' call ? Thank you.
Posted
Updated 9-Apr-11 9:16am
v2

Thanks to my friend, Antonis Chatzipavlis, an expert on all of the .NET technologies & platforms, whom I thank very much, the solution goes like this: In each shortcut, start the application with a command_line argument, for example "myapp.exe start_arg = 1" and then inside the form_load section check for the value of the start_arg argument. Neat. Thankzzz Antonis. John
Antonis suggests the following links:
CmdLineArgs[^]
devx.com Article[^]
programmers-corner[^]
reading command line arguments vb.net[^]
howto list command line arguments[^]
process start vb.net[^]
CmdLine[^]
running a vb.net program with command line arguments[^]
 
Share this answer
 
v2
Comments
Henry Minute 9-Apr-11 16:09pm    
Well done for posting the solution here for others to use. +5
Sandeep Mewara 10-Apr-11 3:13am    
My 5!
I can offer my own work on Command Line; it's very easy to use and higly automate the process of creation of definitions for command line, command line processing and documenting: Enumeration-based Command Line Utility[^]. It was very well accepted by CodeProject community.

I hope you understand that the fact it is in C# makes no difference: there is not any barriers between C# and VB.NET assemblies, as soon as they are the different projects.

—SA
 
Share this answer
 
Comments
Espen Harlinn 10-Apr-11 6:31am    
Certainly a very useful utility class, my 5 - seems OP answered his own question :)
Sergey Alexandrovich Kryukov 10-Apr-11 13:56pm    
Thank you, Espen.
Did he answere his own question? This is a method. :-)
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900