WEB开发网
开发学院WEB开发综合 禁用Alt-Tab或Ctrl-Alt-Del 阅读

禁用Alt-Tab或Ctrl-Alt-Del

 2006-02-27 11:51:20 来源:WEB开发网   
核心提示:PRivateDeclareFunctionEnableWindowLib"user32"(ByValhWndAsInteger,ByValaBOOLAsInteger)AsIntegerPrivateDeclareFunctionIsWindowEnabledLib"user32&quo
PRivateDeclareFunctionEnableWindowLib"user32"(ByValhWndAsInteger,ByValaBOOLAsInteger)AsInteger
PrivateDeclareFunctionIsWindowEnabledLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionGetMenuLib"user32"(ByValhWndAsInteger)AsInteger
PrivateDeclareFunctionFindWindowLib"user32"Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLong
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,ByVallpvParamAsAny,ByValfuWinIniAsLong)AsLong
PrivateTaskBarhWndAsLong
PrivateIsTaskBarEnabledAsInteger
PrivateTaskBarMenuHwndAsInteger

'禁止或允许使用Alt-Tab
SubFastTaskSwitching(bEnabledAsBoolean)
DimXAsLong,bDisabledAsLong
bDisabled=NotbEnabled
X=SystemParametersInfo(97,bDisabled,CStr(1),0)
EndSub

'禁止使用Ctrl-Alt-Del
PublicSubDisableTaskBar()
DimEWindowAsInteger
TaskBarhWnd=FindWindow("Shell_traywnd","")
IfTaskBarhWnd<>0Then
EWindow=IsWindowEnabled(TaskBarhWnd)
IfEWindow=1Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,0)
EndIf
EndIf
EndSub

'允许使用Ctrl-Alt-Del

PublicSubEnableTaskBar()
IfIsTaskBarEnabled=0Then
IsTaskBarEnabled=EnableWindow(TaskBarhWnd,1)
EndIf
EndSub

'禁止Ctrl Alt Del
'声明(ForWin95):

ConstSPI_SCREENSAVERRUNNING=97
PrivateDeclareFunctionSystemParametersInfoLib"user32"Alias"SystemParametersInfoA"(ByValuActionAsLong,ByValuParamAsLong,lpvParamAsAny,ByValfuWinIniAsLong)AsLong
使用:
'禁止
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,True,pOld,0)
'开启
DimpOldAsBoolean
CallSystemParametersInfo(SPI_SCREENSAVERRUNNING,False,pOld,0)

->

Tags:禁用 Alt Tab

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接