-
May 28th, 2012, 07:32 PM
#1
Thread Starter
New Member
Run on start up
I am looking for a way to: if a check box is checked, then the program will run when the computer starts, and if it is not checked, then the program will only run if you open it. So, what I want to have is, if you check the box, you still have to save it by clicking the save button, which dosent work for me now because I have yet to learn it.
The following code below, I found online, and its suppose to make the program start when the computer starts, but I am not sure if it is correct.
Code:
Imports System.IO
Dim FileName As String
Dim filepath As Object
Dim registrykey As Object
FileName = "firstproject.exe"
filepath = Path.GetFullPath(FileName)
registrykey = CreateObject("WScript.Shell")
registrykey.RegWrite("HKEY_LOCAL_Machine\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\frstproject", filepath)
Last edited by Silly; May 28th, 2012 at 08:36 PM.
-
May 28th, 2012, 07:45 PM
#2
Re: Run on start up
viruses, either real or prank, aren't welcomed on vbforums
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 28th, 2012, 08:07 PM
#3
Thread Starter
New Member
Re: Run on start up
Its not a virus, I found that online and I didn't change the code. I just started to program so how would I know how to make a virus >.>
EDIT: Changed the code because the person above that I was making a virus -_-
Last edited by Silly; May 28th, 2012 at 08:39 PM.
-
May 29th, 2012, 01:46 PM
#4
Thread Starter
New Member
Re: Run on start up
I am sure somebody knows how to do this :/
-
May 29th, 2012, 02:10 PM
#5
Re: Run on start up
ok. try this. the last example code is the example you should look at + the registrykey you should write is:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\frstproject
http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
May 29th, 2012, 02:17 PM
#6
Hyperactive Member
Re: Run on start up
This is the tutorial I used to learn how to read/write registry keys recently:
http://social.msdn.microsoft.com/For...f-69222b068fe4
You'll have to adjust the code there to read from/write to the correct location. You'll most likely want to use \HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
-
May 29th, 2012, 06:47 PM
#7
Thread Starter
New Member
Re: Run on start up
Alright thanks, I will try that out
-
Oct 31st, 2014, 07:02 PM
#8
Re: Run on start up
Originally Posted by Silly
Alright thanks, I will try that out
beginners don't generally learn the registry classes.
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
|