program initiation

I am writing a program which it can be started automatically during when the OS is loaded during startup or it can be initiated by a user from say the desktop.
How can let the program know whether it was initiated from bootup or initiated from a user on the desktop
That would depend on your auto-start method. If you are auto-starting from a service then this is no problem since the executable has to be in a different format anyway. If you are auto-starting from the registry, then I would say just add an argument to the start command. If your startup method is more exotic then please let us know what it is.
I have a windows 10 and from what I read all I would need to do is to add the the executable in the autostartup folder
How would I add an argument to what start command.

From what I understand is that the Operating system's entry point into my program is through main(). That would mean that the start command is external, How do I access this start command.
If you put your program in the autostart folder Windows will start it, but without arguments.
To use arguments create a batch file which starts your program with parameters and place the batch file in the autostart folder - at least it worked under Win 7, no sure about Win 10.

Example:
If your prog is called Prog.exe then you put a line in the batch file like this:
Prog.exe Param1 Param2

I just thought of a way that could work for me but not sure, let me know if this is a good idea.

I would create the programs with arguments as suggested by Thomas1965. Put this in a particular directory. Create shortcuts that links back to this directory, one shortcut on the desktop another in the startup folder.
If the program is executed from startup then its path will be used as input to the program
I think I am missing something from this though, any ideas??

Topic archived. No new replies allowed.