| | |
Program Start Up
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
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 |
.net .net2008 2005 2008 access account arithmetic array basic bing browser button buttons center check code combobox component crystalreport cuesent data database datagrid datagridview date datetimepicker design dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter ftp generatetags google hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters pdf picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial settings shutdown soap survey table tcp temperature text textbox timer timespan toolbox transparency trim update updown user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






