开发者

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

  1. C code which sets a program to run at startup for user

  2. 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 :-)


  1. You can have your program register itself in the windows registry to list of program run at startup.

  2. 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜