Results 1 to 11 of 11

Thread: [RESOLVED] how to add my program to start with copmuter

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] how to add my program to start with copmuter

    im looking for a way for the user to pick if he wants to add the program to start with windows or not
    a check box is good enough.
    im looking for something simple

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: how to add my program to start with copmuter

    C:\Documents and Settings\[user name]\Start Menu\Programs\Startup

    I guess a button or checkbox that will copy the EXE to the Startup directory.

    If checked then copy to Startup. If Unchecked then delete from Startup

    You can also put a Shortcut in the Startup directory which means you don't have to copy the application itself

    Something like that, perhaps
    Last edited by jmsrickland; Aug 17th, 2013 at 02:03 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how to add my program to start with copmuter

    this i know my friend
    im talking about putting it in the vb project for the user
    i know there is a code for it

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: how to add my program to start with copmuter

    Oh, sorry, you want VB code to perform the operation. OK, let me think about it. I'm sure someone else will have it but I'll give it a try anyway


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #5
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: how to add my program to start with copmuter

    what you need to do is write to the registry

    specifically this:

    "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"


    http://www.vbforums.com/showthread.p...-Seven-Problem

  6. #6

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how to add my program to start with copmuter

    too many codes
    i know there is a simple way
    for xp and for windows 7
    a check box that if a user checksit then it will start with windows if its unchecked then will not start

  7. #7
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: how to add my program to start with copmuter

    Quote Originally Posted by salsa31 View Post
    too many codes
    i know there is a simple way
    for xp and for windows 7
    a check box that if a user checksit then it will start with windows if its unchecked then will not start
    if the solution is not acceptable, then you wont solve your problem, you have to consider the fact that you need to insert data into the registry, and you need to remove data from the registry when the user doesn't want the application to start up with windows. that code i referred you to is about as short as it gets with both functionalities.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: how to add my program to start with copmuter

    You have 2 basic options

    1: Place a shortcut in the startup folder as shown in post #2
    2: Place a reg entry in the run section as shown in post #5

    Either of these can be placed under the current user section or all users section

    And yes it is a simple way. The shortcut is about as simple as you can get.

    As for the checkbox you would add code that would place either a shortcut or reg entry if they want it to start and remove it if they do not want it to start.

    I added code to my installer that will optionally create a shortcut in the startup folder and/or the desktop for all users.

    You will have to write code if you want to do it from VB, there is no magic checkbox that is just one way to display to the user and no matter how you display it you still have to use either a shortcut or a reg entry.

  9. #9

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how to add my program to start with copmuter

    ill try that

  10. #10
    Junior Member Immanuel's Avatar
    Join Date
    Mar 2013
    Location
    TUT, IN
    Posts
    19

    Re: [RESOLVED] how to add my program to start with copmuter

    Here's what I use

    Code:
    Dim objShell
    
    Private Sub Check1_Click()
    Set objShell = CreateObject("WScript.Shell")
    If Check1.Value = 1 Then
    objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "AppPath"
    Else
    objShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
    End If
    End Sub
    Suppose the user deletes the registry key manually, then upon removing the checkbox, it'd return a value as to the Registry Key is unavailable. To avoid that, create the entry to be sure it exists and then delete it (You can check if it exists using EnumVal and then capturing the returned value, but again, those should be in the link provided above, since you chose not to have it. You can do this,

    Code:
    Dim objShell
    
    Private Sub Check1_Click()
    Set objShell = CreateObject("WScript.Shell")
    If Check1.Value = 1 Then
    objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "AppPath"
    Else
    objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "AppPath"
    objShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
    End If
    End Sub
    Mind you, this is not efficient at all, but it is what you get when you seek something very very simple. :P

  11. #11

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: [RESOLVED] how to add my program to start with copmuter

    tnx man found something already

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