| | |
Program Start Up
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
just copying your .exe file into startup folder.
you can use special folder to do this.
you can use special folder to do this.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
You mean that you want to start up your application from the registry?
Install application to run from the registry:
Remove application from the registry:
I think I've originally grabbed these snippets from somewhere. So the credits go to someone who's name I don't remember anymore
Install application to run from the registry:
VB.NET Syntax (Toggle Plain Text)
''' <summary> ''' Installs an application to start from the registry when Windows starts ''' </summary> ''' <param name="AppName">Application's name</param> ''' <param name="AppPath">Full path to the application</param> ''' <param name="InstallToLocalMachine">Install to LM, otherwise install to current user</param> ''' <returns>True if successfully installed</returns> ''' <remarks>Compatible with Windows XP and Vista</remarks> Public Function StartUpInstall(ByVal AppName As String, ByVal AppPath As String, _ ByVal InstallToLocalMachine As Boolean) As Boolean ' ' Install to registry ' If LM then uses HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ' Otherwise uses HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ' Dim RegRoot As RegistryKey Dim RegKey As RegistryKey Try If InstallToLocalMachine Then RegRoot = Microsoft.Win32.Registry.LocalMachine RegKey = RegRoot.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _ RegistryKeyPermissionCheck.ReadWriteSubTree, _ Security.AccessControl.RegistryRights.SetValue) RegKey.SetValue(AppName, AppPath, RegistryValueKind.String) Return True Else RegRoot = Microsoft.Win32.Registry.CurrentUser RegKey = RegRoot.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _ RegistryKeyPermissionCheck.ReadWriteSubTree, _ Security.AccessControl.RegistryRights.SetValue) RegKey.SetValue(AppName, AppPath, RegistryValueKind.String) Return True End If Catch ex As Exception Return False End Try End Function
VB.NET Syntax (Toggle Plain Text)
''' <summary> ''' Uninstalls an application not to start from the registry when Windows starts ''' </summary> ''' <param name="AppName">Application's name</param> ''' <param name="InstallToLocalMachine">Uninstall from LM, otherwise uninstall from current user</param> ''' <returns>True if successfully uninstalled</returns> ''' <remarks>Compatible with Windows XP and Vista</remarks> Public Function StartUpUnInstall(ByVal AppName As String, _ ByVal InstallToLocalMachine As Boolean) As Boolean ' ' UnInstall from registry ' If LM then uses HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ' Otherwise uses HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ' Dim RegRoot As RegistryKey Dim RegKey As RegistryKey Try If InstallToLocalMachine Then RegRoot = Microsoft.Win32.Registry.LocalMachine RegKey = RegRoot.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _ RegistryKeyPermissionCheck.ReadWriteSubTree, _ Security.AccessControl.RegistryRights.SetValue) RegKey.DeleteValue(AppName, False) Return True Else RegRoot = Microsoft.Win32.Registry.CurrentUser RegKey = RegRoot.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", _ RegistryKeyPermissionCheck.ReadWriteSubTree, _ Security.AccessControl.RegistryRights.SetValue) RegKey.DeleteValue(AppName, False) Return True End If Catch ex As Exception Return False End Try End Function
Teme64 @ Windows Developer Blog
![]() |
Similar Threads
- Elapse Time Since Program Start Working (C++)
- What language to start with (Computer Science)
- Program with many errors (C++)
- Unable to open any DOS program and IE shows DNS error (Web Browsers)
- PC start, but icon not came (Troubleshooting Dead Machines)
- help writing a grep program (C)
- HOW TO PROGRAM C++ homework (C++)
- Start up Menu problems (Windows NT / 2000 / XP)
- Keep Your Favorite Programs Near the Top of the Start Menu (Windows tips 'n' tweaks)
Other Threads in the VB.NET Forum
- Previous Thread: adding item from text box to list box
- Next Thread: using the repeater
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account add arithmetic array assignment basic box button buttons center check code component connectionstring convert cpu crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist editvb.net excel file-dialog firewall folder ftp generatetags hardcopy image images insert intel isnumericfuntioncall math monitor mssqlbackend mysql navigate net networking opacity output passingparameters peertopeervideostreaming picturebox1 port printpreview problem problemwithinstallation project record reports" reuse savedialog searchvb.net select serial storedprocedure string tcp temp text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






