开发者

Running a program at startup

I am currently working on a c# wpf project. I have adde开发者_Python百科d code to the program so that it creates a registry key to start the program automatically at user logon and have also written the program so that it can minimise to the system tray.

When the user launches the program themselves manually I obviously want the program to appear in the middle of the screen like normal but when the program launches automatically at startup I want it to load up minimised.

Is there a way to determine if the program was launched by the user or launched at startup so that I can make it load minimised instead of appearing on the screen at startup.


The easiest way would be to register your registry keys with a command line argument, so that when the program starts up automatically you can simply check the args in your main method.

As long as the user doesn't start it from the command line with that argument, you will be able to determine whether the program was auto-started or the icon was clicked.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜