用VB编写个监控程序,想一直运行,不允许退出,防止操作人员玩系统自带的游戏
1、程序中窗口属性Borderstyle设为None,没有最小化和关闭按钮。退出程序需输入正确密码(软键盘)。
2、在注册表(regedit)“HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run”下新建一个字符串,其值设置为自动执行程序名,将它的数据设成程序所在目录,即可将该程序设置自动执行。
3、隐藏任务栏
声明
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Const SWP_SHOWWINDOW = &H40
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_NOACTIVATE = &H10
程序开始禁止任务栏,退出时显示任务栏
hide = FindWindow("shell_traywnd", vbNullString) 禁止任务栏
Call SetWindowPos(hide, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
hide = FindWindow("shell_traywnd", vbNullString) 显示任务栏
Call SetWindowPos(hide, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
以上只限于没有键盘的情况下,有键盘很难禁止其它程序运行。