Is it somehow possible to detect whether program was started by a user or it was started automatically from registry at Windows start up?
views:
59answers:
3
+6
A:
The simplest way i know of would be to add a "--startup" or similar option to the command line for the startup shortcut (or the value in Run), and check for that in your app. If it's there, then the app is being run by Windows; otherwise, the user is running it.
cHao
2010-10-31 14:20:32
+1
A:
Another option would be to get the current process and check the Parent
property. Processes started by a user will have explorer as their parent. (Or some other app that launched them). The processes launched at startup will have a different or non-existent parent.
Mark H
2010-10-31 17:31:05
+1
A:
My solution:
string[] args = Environment.GetCommandLineArgs();
if (args[1] == "-hide")
{
//Hide
}
Badr Hari
2010-10-31 21:27:44