Results 1 to 8 of 8

Thread: [RESOLVED] knows how to make a VB automatically start up immediately right after XP

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Resolved [RESOLVED] knows how to make a VB automatically start up immediately right after XP

    Does anyone knows how to make a VB project (already compiled and published) to automatically start up immediately right after XP has finish its start up sequence (has boot up already)

    Thanks

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Re: knows how to make a VB automatically start up immediately right after XP

    I mean in code without putting a shortcut in the "Startup" menu.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: knows how to make a VB automatically start up immediately right after XP

    You can't. If your app is not running then it can't do anything, including start itself. You need to either put a shortcut in the Startup folder or add an entry to the Run section of the registry. Your app can do either of these things in code so that on future boots it will be started automatically. The only other option would be to write a service that itself starts automatically and then it starts your app, but why do such a convoluted thing?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Re: knows how to make a VB automatically start up immediately right after XP

    or add an entry to the Run section of the registry. Your app can do this in code
    I like this very much, is the code to do this too complicated?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: knows how to make a VB automatically start up immediately right after XP

    VB Code:
    1. Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath)
    Note that this will cause the current application to be run on subsequent boots for all users. if you want it to apply to just the current user you would substitute CurrentUser for LocalMachine. Also note that this will use the value that you have set for AssemblyProduct in the AssemblyInfo.vb as the name of the value in the registry. You can use another name if you like but this is the logical choice. If you haven't set that value in the AssemblyInfo.vb file then I suggest you remedy that situation for every project you are working on, whether you want to store it in the registry or not.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Re: knows how to make a VB automatically start up immediately right after XP

    That's All jmcilhinney?

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: knows how to make a VB automatically start up immediately right after XP

    You think I'm holding something back? That single line of code will create a value with the specified name under the HKLM\Software\Microsoft\Windows\CurrentVersion\Run key if it does not exist and set it to the fully qualified path to your executable. Each time the system boots Windows checks that key and executes each of the commandlines it finds.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Thumbs up Re: knows how to make a VB automatically start up immediately right after XP

    Thanks you are awesome!!!

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