Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Question about run at start up

Question about run at start up

Scheduled Pinned Locked Moved C / C++ / MFC
question
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mazdak
    wrote on last edited by
    #1

    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.

    V N R 3 Replies Last reply
    0
    • M Mazdak

      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.

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      There are several solutions. One solution is for the program to determine the active user upon startup. Kuphryn

      M 1 Reply Last reply
      0
      • V valikac

        There are several solutions. One solution is for the program to determine the active user upon startup. Kuphryn

        M Offline
        M Offline
        Mazdak
        wrote on last edited by
        #3

        kuphryn wrote: One solution is for the program to determine the active user upon startup. Could you please explain it more? Mazy No sig. available now.

        1 Reply Last reply
        0
        • M Mazdak

          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.

          N Offline
          N Offline
          Nicolas Bonamy
          wrote on last edited by
          #4

          Use the same key but under HKEY_CURRENT_USER. Regards

          M 1 Reply Last reply
          0
          • N Nicolas Bonamy

            Use the same key but under HKEY_CURRENT_USER. Regards

            M Offline
            M Offline
            Mazdak
            wrote on last edited by
            #5

            But there is a problem with that.It should run for all users at the first installation,then uses can change it.If I use that it will only run for the user that install it and will not run by default. Mazy No sig. available now.

            1 Reply Last reply
            0
            • M Mazdak

              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.

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              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"

              M A 2 Replies Last reply
              0
              • R Ryan Binns

                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"

                M Offline
                M Offline
                Mazdak
                wrote on last edited by
                #7

                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.

                R 1 Reply Last reply
                0
                • R Ryan Binns

                  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"

                  A Offline
                  A Offline
                  Anonymous
                  wrote on last edited by
                  #8

                  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

                  R 1 Reply Last reply
                  0
                  • M 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.

                    R Offline
                    R Offline
                    Ryan Binns
                    wrote on last edited by
                    #9

                    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"

                    1 Reply Last reply
                    0
                    • A Anonymous

                      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

                      R Offline
                      R Offline
                      Ryan Binns
                      wrote on last edited by
                      #10

                      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"

                      M 1 Reply Last reply
                      0
                      • R Ryan Binns

                        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"

                        M Offline
                        M Offline
                        Mazdak
                        wrote on last edited by
                        #11

                        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.

                        R 1 Reply Last reply
                        0
                        • M Mazdak

                          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.

                          R Offline
                          R Offline
                          Ryan Binns
                          wrote on last edited by
                          #12

                          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"

                          M 1 Reply Last reply
                          0
                          • R Ryan Binns

                            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"

                            M Offline
                            M Offline
                            Mazdak
                            wrote on last edited by
                            #13

                            Thanks Ryan :) Mazy No sig. available now.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups