简体   繁体   English

如何在登录Windows XP之前运行我的程序?

[英]How to run my program on before login on windows XP?

Hai, I have a simple smile face program in c# which stored login time in d:\\time.txt file.But when I add the program at"gpedit.msc" then Computer Configuration->Windows Settings->Scripts(Start up/Shutdown)->stratup->DOUBLE CLICK then Add the "my.exe", for every single login. Hai,我在c#中有一个简单的笑脸程序,将登录时间存储在d:\\ time.txt文件中。关机) - > stratup-> DOUBLE CLICK然后为每次登录添加“my.exe”。 I found that Its worked only first time when i boot the system.but If I restart the machine after suppose 15-20 mins, the time not change in file and even the smile face also not comes more then one time login. 我发现它仅在我启动系统时第一次起作用。但如果我在假设15-20分钟后重新启动机器,那么文件中的时间不会改变,甚至笑脸也不会超过一次登录。

anyone can help me to run this program every time when i login in PC. 每次我登录PC时,任何人都可以帮我运行这个程序。

What you put under Startup/Shutdown runs at startup/shutdown, not logon/logoff. 您在“启动/关闭”下放置的内容在启动/关闭时运行,而不是在登录/注销时运行。

When you want to run them at login, you need to put them under Logon/Logoff. 如果要在登录时运行它们,则需要将它们置于Logon / Logoff下。

You'll find that under User Configuration -> Windows Settings. 您将在“用户配置” - >“Windows设置”下找到该文件。

As i am in hurry, i can not add code atm. 因为我很着急,我无法添加代码atm。
Another approach would be creating your programm as a service (which is simply done by usind the corresponding project template within visual studio). 另一种方法是将您的程序作为服务创建(只需通过在Visual Studio中使用相应的项目模板即可完成)。 This service would listen to a windows message that is fired whenever a user is logged on. 此服务将侦听用户登录时触发的Windows消息。

A service delivers also some further advantaged you might want to use ;) 服务还提供了一些您可能想要使用的优势;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM