I am making an application that will sit in the system tray and open a window when a user clicks it, the problem is I want the application to be run from start up using an exe, adding the application to the system tray without opening a window. but when the user opens the application on their own I want the window to pop up. how can i determine weather the application was run on boot up or by the user?
Asked
Active
Viewed 364 times
0
-
Related: http://stackoverflow.com/q/17363820/1065197 – Luiggi Mendoza Nov 20 '13 at 22:54
-
If you don't need to care about the crackability of the check, I suggest that you use a command-line argument or an environment variable to determine that. For instance, you might implement a -startup option to indicate the application is being started automatically. – Giulio Franco Nov 20 '13 at 23:28
2 Answers
1
You can write a class that through JNI you call some windows libraries that has a Enum with all the processes and information about it. This way you find your process and see who executed it. Process Information

Jorge Campos
- 22,647
- 7
- 56
- 87
-
i want to use an exe to point to the jar so on windows wont it always show thats how it was started? – adam Nov 20 '13 at 23:08
-
He could use a tool to do just the same, or do it implementing itself reading the info from 'ps' command – Jorge Campos Nov 20 '13 at 23:09
-
@xFlRSTx On the windows information process you have all the type of info inclundind the owner of the process. On the windows startup if the process is set to the user then you have to combine the onwer information with the execution method (line command used). – Jorge Campos Nov 20 '13 at 23:11
0
You can run the main method of your class with different args or have two different classes with main methods for each use case.

Decly
- 379
- 2
- 11