Question about run at start up
-
I want to run my program at start up,so I set the registery key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run for doing this.But I want my users can change the setting so my program may run at start up for some users. How can I handle it that it does not run for some users? Thanks Mazy No sig. available now.
-
I want to run my program at start up,so I set the registery key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run for doing this.But I want my users can change the setting so my program may run at start up for some users. How can I handle it that it does not run for some users? Thanks Mazy No sig. available now.
-
There are several solutions. One solution is for the program to determine the active user upon startup. Kuphryn
-
I want to run my program at start up,so I set the registery key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run for doing this.But I want my users can change the setting so my program may run at start up for some users. How can I handle it that it does not run for some users? Thanks Mazy No sig. available now.
Use the same key but under HKEY_CURRENT_USER. Regards
-
Use the same key but under HKEY_CURRENT_USER. Regards
-
I want to run my program at start up,so I set the registery key HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run for doing this.But I want my users can change the setting so my program may run at start up for some users. How can I handle it that it does not run for some users? Thanks Mazy No sig. available now.
Use that key, but make your program check some value under HKEY_CURRENT_USER that the user can use to specify whether the program is to run. This way the program run for all users, but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal. Hope this helps Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Use that key, but make your program check some value under HKEY_CURRENT_USER that the user can use to specify whether the program is to run. This way the program run for all users, but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal. Hope this helps Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Use that key, but make your program check some value under HKEY_CURRENT_USER that the user can use to specify whether the program is to run. This way the program run for all users, but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal. Hope this helps Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"I have another problem now. Ryan Binns wrote: but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal What happend if user want to run by him/herself after start up.Then he/she can not run the program because that key does not exist. Mazdak
-
hmmm,thanks Roger. Ryan Binns wrote: but if the user-specific key is set to some value, then exit immediately. Do you think other program use thiis techniqe,run the program and exit immediatley! Mazy No sig. available now.
More often than you'd think :) Yes, it's a fairly common technique - to start and program to actually see whether it needs to be started. It sounds crazy but it's one of the best ways of doing it. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
I have another problem now. Ryan Binns wrote: but if the user-specific key is set to some value, then exit immediately. If the user-specific key does not exist, then just continue as normal What happend if user want to run by him/herself after start up.Then he/she can not run the program because that key does not exist. Mazdak
Anonymous wrote: What happend if user want to run by him/herself after start up.Then he/she can not run the program because that key does not exist. You didn't specify that before ;P I would still do the same thing, but specify some sort of parameter ("/startup" comes to mind) on the command line when run from the registry Run key. If this parameter is not present, then you can assume that the user ran it from a shortcut, and just run as usual. If the parameter is present, then you can assume it was run from the registry, and then do the operation I suggested before. I've written a couple of programs that do this and it works beautifully. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Anonymous wrote: What happend if user want to run by him/herself after start up.Then he/she can not run the program because that key does not exist. You didn't specify that before ;P I would still do the same thing, but specify some sort of parameter ("/startup" comes to mind) on the command line when run from the registry Run key. If this parameter is not present, then you can assume that the user ran it from a shortcut, and just run as usual. If the parameter is present, then you can assume it was run from the registry, and then do the operation I suggested before. I've written a couple of programs that do this and it works beautifully. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
thanks. Its a nice tip. But how can I pass parameter when I run from the registery key? I guess I have to write something in some place of registry? Mazy No sig. available now.
Exactly the same as in a shortcut - on the end of the program string value in the registry "c:\my path\myprog.exe" /startup or something similar. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact" -
Exactly the same as in a shortcut - on the end of the program string value in the registry "c:\my path\myprog.exe" /startup or something similar. Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"