Valhalla Legends Forums Archive | Visual Basic Programming | Starting a visual basic program.

AuthorMessageTime
Kaiory
If done some light searching and am still trying to find it but, how can I make my visual basic program start when windows starts?
May 25, 2005, 10:32 PM
Myndfyr
[quote author=Kaiory link=topic=11703.msg113727#msg113727 date=1117060358]
If done some light searching and am still trying to find it but, how can I make my visual basic program start when windows starts?
[/quote]
Put it (or a shortcut to it) in the Startup folder in your Start menu.

Alternatively, add it to (HKCU or HKLM)\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.  Create a new String value with a title and the fully-qualified path to the image.
May 25, 2005, 10:37 PM
Kaiory
Thanks for the reply, but I mean through visual basic. Is there a command for it to start with windows?
May 25, 2005, 10:41 PM
Myndfyr
[quote author=Kaiory link=topic=11703.msg113730#msg113730 date=1117060872]
Thanks for the reply, but I mean through visual basic. Is there a command for it to start with windows?
[/quote]

That doesn't make sense.  Programs don't control Windows at start-up; Windows controls programs at start-up.  Which means, if you want to run a program at start-up, you need to do one of the things I listed above.

You can set a registry key through VB, although it should be done at an installation program that will automatically undo it at uninstallation.  Googling for "set registry value visual basic" should yield some great results.
May 25, 2005, 10:48 PM
Kaiory
Yes, I relized that would be a very good alternative because I was still thinking there was a command.  But thanks a great deal, that helped a lot.
May 25, 2005, 10:49 PM
R.a.B.B.i.T
1. Open DOS/Command Prompt
2. shortcut /f:"^%WINDIR^%\Startup\MyProgram.lnk" /a:c /t:"C:\Path\To\Program.exe"
3. Hit enter
4. Close
May 25, 2005, 11:16 PM
Yegg
If you do what rabbit suggested, maybe you can use the Shell command in VisualBasic6 (I'm not sure if Shell has that capability, maybe you'll have to use something else) to do that task.
May 26, 2005, 7:21 PM
Kaiory
I could have it open a bash file. Which would work fine.
May 26, 2005, 9:59 PM
Myndfyr
[quote author=Yegg link=topic=11703.msg113846#msg113846 date=1117135267]
If you do what rabbit suggested, maybe you can use the Shell command in VisualBasic6 (I'm not sure if Shell has that capability, maybe you'll have to use something else) to do that task.
[/quote]

You could, but you'd have to have Windows run the program that has the Shell command in it.
May 26, 2005, 10:13 PM
R.a.B.B.i.T
cmd, or command, depending on the version of Windows.
May 26, 2005, 10:46 PM
Quarantine
Just write to the registry, it isn't hard.
May 26, 2005, 11:11 PM
Myndfyr
Look guys, one way or the other, something has to go into Startup or into registry \Software\Microsoft\Windows\CurrentVersion\Run.  Those are the two easiest ways to make something start at startup for user mode.  Want it to run for everyone?  Put it in HKLM or in All Users\Start Menu\Programs\Startup.

Otherwise, you're going to have to put it into a service process that is configured to be able to interact with the usermode desktop, or into a kernel-mode driver that's going to need a user-mode component to start up like I suggested anyway.

No matter what you end up trying to do, this is how you have something start with Windows.  Making a bash file?  You'll have to put the batch command line into one of the startup paths.  Making a shortcut?  It has to go into the startup menu.
May 26, 2005, 11:53 PM

Search