-
Aug 17th, 2013, 12:55 PM
#1
Thread Starter
Enjoy the moment
[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
-
Aug 17th, 2013, 01:09 PM
#2
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.
-
Aug 17th, 2013, 01:17 PM
#3
Thread Starter
Enjoy the moment
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
-
Aug 17th, 2013, 01:20 PM
#4
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.
-
Aug 17th, 2013, 01:33 PM
#5
Fanatic Member
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
-
Aug 17th, 2013, 01:36 PM
#6
Thread Starter
Enjoy the moment
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
-
Aug 17th, 2013, 01:42 PM
#7
Fanatic Member
Re: how to add my program to start with copmuter
Originally Posted by salsa31
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.
-
Aug 17th, 2013, 01:44 PM
#8
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.
-
Aug 17th, 2013, 01:48 PM
#9
Thread Starter
Enjoy the moment
Re: how to add my program to start with copmuter
-
Aug 18th, 2013, 04:33 AM
#10
Junior Member
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
-
Aug 18th, 2013, 04:51 AM
#11
Thread Starter
Enjoy the moment
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|