Windows- C code to make a program run at startup
I am making a C program that, running with admin privileges, makes another .exe (also in C) to run at startup for one/all user(s), in the background. Other answers use .net, but how do I do it in C, developed in minGW?
So
C code which sets a program to run at startup for user
the installed program to run in the background (without opening a terminal)
Yes, I feel it's suffici开发者_JAVA技巧ently distinct enough to be asked on it's own :-)
You can have your program register itself in the windows registry to list of program run at startup.
You need to link to the windows subsystem instead of the console subsystem. This can be done by passing the
-Wl,-subsystem,windows
togcc
when linking your program.
Easy to ask... non-trivial to answer in a code snippet. It looks like you're trying to create a windows service, which involves interacting with the Service Control Manager to register and start the service. You might want to start off by looking at the MSDN site and here and come back when you have more specific questions.
精彩评论