控制鼠标移动范围用api函数ClipCursor: 【VB声明】 Private Declare Function ClipCursor Lib "user32" Alias "ClipCursor" (lpRect As Any) As Long【说明】 将指针限制到指定区域。ClipCursorBynum是一个别名,允许我们清除以前设置的指针剪切区域 【返回值】 Long,非零表示成功,零表示失败。会设置GetLastError 【备注】 指针剪切后,按Ctrl+Alt+Del可简单的清除剪切区域【参数表】 lpRect --------- RECT,指定一个矩形,用像素屏幕坐标系统表示。鼠标指针必须在这个区域内运动。如使用函数的ClipCursorBynum形式,则可将参数设为Long值,用它传递一个0,禁止指针剪切,恢复常规运作状态
Const SPI_SCREENSAVERRUNNING = 97 Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As LongCall SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)'锁定 Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)'解除
1.将系统锁定就象按装驱动程序时的效果: Option Explicit Private Declare Function GetShellWindow Lib "user32" () As Long Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Const PROCESS_TERMINATE = 1Private Sub Command1_Click() Dim hwnd, dwProcessId As Long, hProcess As Long hwnd = GetShellWindow
End SubPrivate Sub Command2_Click() Shell "explorer.exe" End Sub
2.锁定鼠标移动范围: Private Type RECT left As Long top As Long right As Long bottom As Long End Type Private Type POINT x As Long y As Long End Type Private Declare Sub ClipCursor Lib "user32" (lpRect As Any) Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINT) Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) Private Sub Form_Load() Command1.Caption = "Limit Cursor Movement" Command2.Caption = "Release Limit" End Sub Private Sub Command1_Click() 'Limits the Cursor movement to within the form. Dim client As RECT Dim upperleft As POINT 'Get information about our wndow GetClientRect Me.hWnd, client upperleft.x = client.left upperleft.y = client.top 'Convert window coördinates to screen coördinates ClientToScreen Me.hWnd, upperleft 'move our rectangle OffsetRect client, upperleft.x, upperleft.y 'limit the cursor movement ClipCursor client End Sub Private Sub Command2_Click() 'Releases the cursor limits ClipCursor ByVal 0& End Sub Private Sub Form_Unload(Cancel As Integer) 'Releases the cursor limits ClipCursor ByVal 0& End Sub
【VB声明】
Private Declare Function ClipCursor Lib "user32" Alias "ClipCursor" (lpRect As Any) As Long【说明】
将指针限制到指定区域。ClipCursorBynum是一个别名,允许我们清除以前设置的指针剪切区域 【返回值】
Long,非零表示成功,零表示失败。会设置GetLastError 【备注】
指针剪切后,按Ctrl+Alt+Del可简单的清除剪切区域【参数表】
lpRect --------- RECT,指定一个矩形,用像素屏幕坐标系统表示。鼠标指针必须在这个区域内运动。如使用函数的ClipCursorBynum形式,则可将参数设为Long值,用它传递一个0,禁止指针剪切,恢复常规运作状态
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As LongCall SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)'锁定
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)'解除
Option Explicit
Private Declare Function GetShellWindow Lib "user32" () As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Const PROCESS_TERMINATE = 1Private Sub Command1_Click()
Dim hwnd, dwProcessId As Long, hProcess As Long hwnd = GetShellWindow
GetWindowThreadProcessId hwnd, dwProcessId hProcess = OpenProcess(PROCESS_TERMINATE, False, dwProcessId) TerminateProcess hProcess, 1
CloseHandle hProcess
End SubPrivate Sub Command2_Click()
Shell "explorer.exe"
End Sub
Private Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
Private Type POINT
x As Long
y As Long
End Type
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Private Declare Sub GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT)
Private Declare Sub ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINT)
Private Declare Sub OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long)
Private Sub Form_Load()
Command1.Caption = "Limit Cursor Movement"
Command2.Caption = "Release Limit"
End Sub
Private Sub Command1_Click()
'Limits the Cursor movement to within the form.
Dim client As RECT
Dim upperleft As POINT
'Get information about our wndow
GetClientRect Me.hWnd, client
upperleft.x = client.left
upperleft.y = client.top
'Convert window coördinates to screen coördinates
ClientToScreen Me.hWnd, upperleft
'move our rectangle
OffsetRect client, upperleft.x, upperleft.y
'limit the cursor movement
ClipCursor client
End Sub
Private Sub Command2_Click()
'Releases the cursor limits
ClipCursor ByVal 0&
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Releases the cursor limits
ClipCursor ByVal 0&
End Sub
编个程序
盖住桌面
任务栏就用截屏再把任务栏的图像截下来显示
没发现网吧里的桌面啊,任务栏都是假的阿
还有个办法就是把Explorer这个进程Kill掉(开机之后的第一个不是我的电脑或资源管理器什么的,代表的就是系统)
这样就没桌面了
再读取图标什么的
就是模仿
屏蔽的话最主要的是屏蔽键
所以.....
看到了没有
机房里
都用98的
用SystemParamInfo搞定(屏蔽键)
我2年没用VB了
嘿嘿