1 2 3 4 5 6 7 8 | <div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%">1 2 3 4</pre></td><td><pre style="margin: 0; line-height: 125%">Imports Microsoft<span style="color: #666666">.</span><span style="color: #7D9029">Win32</span> Dim regKey As RegistryKey Dim strName As String <span style="color: #666666">=</span> <span style="color: #BA2121">"ComicAutoDownload"</span> </pre></td></tr></table></div> |
1 2 3 4 5 6 7 8 9 10 11 | 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run Private Sub chkAutoRun_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAutoRun.CheckedChanged regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", True) 'regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", True) If chkAutoRun.Checked = True Then regKey.SetValue(strName, Application.ExecutablePath) Else regKey.SetValue(strName, "") End If regKey.Close() End Sub |
1 2 3 4 5 6 7 8 9 | Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", True) 'regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", True) If regKey.GetValue(strName) <> "" And regKey.GetValue(strName) = Application.ExecutablePath Then chkAutoRun.Checked = True Me.Opacity = 0 Timer1.Enabled = True End If End Sub |
1 2 3 4 5 6 | Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Timer1.Enabled = False Me.Hide() Me.Opacity = 100 NotifyIcon1.Visible = True End Sub |
1 2 3 4 5 6 | Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize If Me.WindowState() = FormWindowState.Minimized Then Me.Hide() NotifyIcon1.Visible = True End If End Sub |
1 2 3 4 5 6 | Private Sub NotifyIcon1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.Click Me.Show() Me.Activate() Me.WindowState = FormWindowState.Normal NotifyIcon1.Visible = False End Sub |
沒有留言:
張貼留言