غیر فعال کردن تسک منیجر در ویندوز 7
کد:
Private Sub DisableTaskManager(ByVal cmd As Integer)
Dim systemRegistry As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
systemRegistry.SetValue("DisableTaskMgr", cmd)
systemRegistry.Close()
End Sub
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Visual Basic 4 / 5 / 6 Syntax
Public Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
x = SystemParametersInfo(97, 1, CStr(1), 0) 'Disable Ctrl+Alt+Del Keys combination
'Use as in --->>>
If KeyAscii >= vbKeyA And KeyAscii <= vbKeyZ Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii >= vbKey0 And KeyAscii <= vbKey9 Or KeyAscii = vbKeyBack Then
'do nothing
Else
KeyAscii = 0 'Disable all other key strokes
End If
بردن برنامه به استارت آپ در ویندوز 7
کد:
''' Installs an application to start from the registry when Windows starts '''
'''
''' Application's name
''' Full path to the application
''' Install to LM, otherwise install to current user
''' True if successfully installed
''' Compatible with Windows XP and Vista
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
Remove application from the registry:
''' Uninstalls an application not to start from the registry when Windows starts '''
'''
''' Application's name
''' Uninstall from LM, otherwise uninstall from current user
''' True if successfully uninstalled
''' Compatible with Windows XP and Vista
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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValueApplication.ProductName, Application.ExecutablePath)
End Sub
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dim startup As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup)
IO.File.Copy(Application.ExecutablePath, startup & "\Poise.exe")
منبع :
http://www.kinga.ir/