用vb編寫個監(jiān)控程序,想一直運行,不允許退出,防止操作人員玩系統(tǒng)自帶的游戲
1、程序中窗口屬性borderstyle設(shè)為none,沒有最小化和關(guān)閉按鈕。退出程序需輸入正確密碼(軟鍵盤)。
2、在注冊表(regedit)“hkey_local_machine\software\microsoft\windows\currentversion\run”下新建一個字符串,其值設(shè)置為自動執(zhí)行程序名,將它的數(shù)據(jù)設(shè)成程序所在目錄,即可將該程序設(shè)置自動執(zhí)行。
3、隱藏任務(wù)欄
'聲明
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
'程序開始禁止任務(wù)欄,退出時顯示任務(wù)欄
hide = findwindow(shell_traywnd, vbnullstring) '禁止任務(wù)欄
call setwindowpos(hide, 0, 0, 0, 0, 0, swp_hidewindow)
hide = findwindow(shell_traywnd, vbnullstring) '顯示任務(wù)欄
call setwindowpos(hide, 0, 0, 0, 0, 0, swp_showwindow)
以上只限于沒有鍵盤的情況下,有鍵盤很難禁止其它程序運行。