03-16-2016 09:45 AM
Hi all,
This is a Windows question : is there a way to know from within my app (when it runs as an EXE) if it was launched by the user (clic on the EXE file) or if the app was lauched by the OS because it is in the startup?
Thanks in advance for any help
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
Solved! Go to Solution.
03-16-2016 09:49 AM
Why not ask a car question while you are at it? 😉
03-16-2016 10:00 AM
I don't know if there is, but you could probably configure the shortcut to pass an argument as part of the call and then check in your code whether you receive it or not. I don't like this because it relies on a hidden configuration in the shortcut, so I would probably prefer a bat file rather than a shortcut.
03-16-2016 10:02 AM
It makes sense! Thanks for the batch + argument idea.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
03-16-2016 11:16 AM
@tst wrote:I don't know if there is, but you could probably configure the shortcut to pass an argument as part of the call and then check in your code whether you receive it or not. I don't like this because it relies on a hidden configuration in the shortcut, so I would probably prefer a bat file rather than a shortcut.
It's possible to do something similar to this without modifying your LabVIEW code - if you look in task manager, under processes - there is a column (hidden by default) called 'command line' - it shows the command line arguments that were passed to the application when it was launched. If you set your 'start up' application to launch with a command line (e.g. using a shortcut / batch file) you can then see this in the task manager.
You can probably get the command line arguments of another process using the .NET process library.