1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
Class clsAutoStart
Private Reg As Microsoft.Win32.RegistryKey
Private m_AutoStart As Boolean
Public Property AutoStart() As Boolean
Get
Dim O As Object
Reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
O = Reg.GetValue(My.Application.Info.ProductName, "")
If O Is Nothing OrElse O.ToString.Length = 0 OrElse O.ToString <> Application.ExecutablePath Then
Return False
Else
Return True
End If
End Get
Set(ByVal value As Boolean)
If value = True Then
Reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
Reg.SetValue(My.Application.Info.ProductName, Application.ExecutablePath)
Else
Reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
Reg.SetValue(My.Application.Info.ProductName, "")
End If
End Set
End Property
End Class
|