Reputation: 23078
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 sufficiently distinct enough to be asked on it's own :-)
Upvotes: 2
Views: 2325
Reputation: 44483
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
to gcc
when linking your program.
Upvotes: 2
Reputation: 10839
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.
Upvotes: 2