|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Startup Program
Hello i'm new at this but i need help on how to make a program made in visual basic to load when yo turn on the computer.
|
|
#2
|
|||
|
|||
|
You can, for instance, use the TextStream object in the FileSystemObject object model to write the path and name of the program to autoexec.bat. This is, though, a technique inherited from the days of DOS; many users, when they decide that they don't want the program loaded at startup, are not likely to know that they should check their autoexec.bat file. An even worse alternative is using the initialization file functions in the Win32 API to write to the Load= or Run= lines of Win.ini. In my experience, applications started in this manner often tend to behave erratically.
The two best methods for automatically launching a program at startup are to use the registry or the system's Startup folder. Which method you choose depends on how easy you want to make it for the user to remove the program if he or she decides that it shouldn't run at system startup. Using the Startup folder gives the user more control; to prevent the program from running at startup, the user just has to remove its shortcut from the folder. Using the registry makes it less accessible; the user will have to be familiar with the structure of the registry and will have to know how to use an editing tool like RegEdit in order to prevent the application from running at startup |
|
#3
|
|||
|
|||
|
And how can i make that when i'm creatin the setup file of the program?
|
|
#4
|
|||
|
|||
|
If you decide that you want to use the registry, you need to make two major decisions. First, you must select the registry key in which you will write the startup information. This decision depends in large part on the character of your application and on why you want to launch it at startup. Second, you need to select a method for writing to the registry.
You can run an application automatically by writing a value entry (a complete name/value pair) to any of the following registry keys (I'll use abbreviations here for the top-level keys): HKCU\Software\Microsoft\Windows\CurrentVersion\Run Launches a program automatically when a particular user logs in. This key is used when you always want to launch a program when a particular user is using a system. HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce Launches a program the next time the user logs in and removes its value entry from the registry. This key is typically used by installation programs. HKLM\Software\Microsoft\Windows\CurrentVersion\Run Launches a program automatically at system startup. This key is used when you always want to launch a program on a particular system. HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce Launches a program the next time the system starts and removes its value entry from the registry. This key is typically used by installation programs. HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices Launches a service (a standard NT service or a background process) automatically at startup. An example of a service is a Web server such as Microsoft Internet Information Server. HKLM\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce Launches a service (a standard NT service or a background process) the next time the system is started, then removes its value entry from the registry. In each case, you load your application by writing a name/value pair to the appropriate key. The key's name is arbitrary, as long as it is unique among the value entries belonging to that key. The entry's value is the complete path and filename of the file to be run. |
|
#5
|
|||
|
|||
|
Do you have an example i can see
|
|
#6
|
|||
|
|||
|
I think you're not understanding what causes startup, neither one of these is handled by vb, i don't think you can do it that way, this is handled by windows.
both of these reside in the HKCU\Software\Microsoft\Windows\CurrentVersion\Run Open regedit, and go to this location, the HKCU launches a program automatically when a particular user logs in: C:\PROGRA~1\AIM\aim.exe -cnetwait.odl "C:\Program Files\MSN Messenger\msnmsgr.exe" /background i chose these 2 cause it's 2 everyone can relate too, the first is a dos example where you just give it the path and then the last part is the arguments, the other is more what youll see in explorer, you put parens around it since it contains spaces and will interpret the spaced part as something you're attempting to pass it. These are in the local user so it will only run when I sign onto this machine. This is good if you're writing a program and want it to run on your start up. So write to this location i recommend.... If you're a beginner, i recommend just adding a shortcut in the startup part of the start menu, just go to start menu and then programs and you'll see start up, you'll have to check windows/starmenu in explorer double check cause i can't remember off hand, but keep in mind, users can just delete this shortcut, the registry is more sophiticated for your program to make sure the program runs on start up, but that can get annoying so make sure you allow the user to disable start program at start up as well... |
|
#7
|
|||
|
|||
|
I hope this helped, if not, i just figured out a new way due to this, mainly because necessity and figured i'd share with you
I have a powerpoint add in which allows me to stream the presentation accross an intranet, however i have to be a member of this intranet domain in order to run this and the add in is installed on my profile only. i don't have permissions to install this addin in the other peoples directories, but i do have admin to the computer. So I opened gpedit.msc (how to run programs triggered by a group) and under "user configuration" Administrative templates/system/logon Edited "run these programs at user logon" Enter "regedit /s c:\windows\system32\softvppaddin.txt" What this will do is run this text file through regedit anytime a user turns on the computer. And it's not in msconfig which is where most people look so it's even trickier, you could run your vb.exe this way. this softvppaddin.txt file was just a regedit entry to add in the path to the program file to the current user HKey. The only way to write to HKey_Local_User is when that user signs on, so when the script runs that text as the user logs on it automatically puts the add in in the powerpoint for them. tricky huh? |
|
#8
|
|||
|
|||
|
Thanks a lot for your help it has been very useful
Sorry at first i didn't explain myself but my native language it's not english so i didn't knew how to ask th right question thanks anyway |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Startup Program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|