Results 1 to 5 of 5

Thread: Running from Registry on Startup/Shutdown

  1. #1

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Could someone remind me what the key is for running an app on startup, and is it possible to do the same thing on shutdown?- CHEEEEEEEERS.

  2. #2
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Talking

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce


    That one you mean?



  3. #3

    Thread Starter
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    Erm, dunno Judd. I was thinking I might put the name of the file I want to run in somewhere. Can I do this on Startup and Shutdown?

  4. #4
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Talking

    For startup to run the program once (i.e. only on the next restart) use the Key I already gave.

    To run on startup everytime use

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

    (Have a look there and you'll see what you need to enter)

    I don't know about shutdown....



    Dan

  5. #5
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    If you want your app to run at shut down the only way I know is to make it into a TSR. This means that after you run your program (at startup or whenever) and it is done doing what you need it to do you hide it/minimize it/put an icon in the System Tray/whatever. In your code you put the tasks you want handle when Windows shuts down in the QueryUnload event, as follows:
    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
       If UnloadMode = vbAppWindows Then
          MsgBox "Current Windows session ending."
          Cancel = True
          Call YourWindowsShutRoutine
       End If
    End Sub
    I hope you get what I'm saying, if not I'll be happy to elaborate.
    Dan PM
    Analyst Programmer

    VB6 SP3 (also VB4 16-bit sometimes )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width