常用的一组API操作
来源:互联网 发布:h3c将端口划分vlan 编辑:程序博客网 时间:2024/05/16 13:03
常用的一组API操作
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Type POINTAPI
x As Long
y As Long
End Type
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Private Const sy = "Shell_Traywnd" '任务栏
Private Const bu = "Button" '开始按钮
Private Const pr = "Progman" '桌面
Private Const desk = "ShellDll_Defview"
Private wnd As Long
Public Sub Hideyi() '隐藏任务栏
wnd = FindWindow(sy, vbNullString)
ShowWindow wnd, SW_HIDE
End Sub
Public Sub Showyi() '显示任务栏
wnd = FindWindow(sy, vbNullString)
If wnd <> 0 Then ShowWindow wnd, SW_SHOW
End Sub
Public Sub Hidegs() '隐藏开始按钮
wnd = FindWindow(sy, vbNullString) '先是查找任务栏.即顶级窗口
wnd = FindWindowEx(wnd, 0, bu, vbNullString) '后查找子窗口
If wnd <> 0 Then ShowWindow wnd, SW_HIDE
End Sub
Public Sub Showgs() '显示开始按钮
wnd = FindWindow(sy, vbNullString)
wnd = FindWindowEx(wnd, 0, bu, vbNullString)
If wnd <> 0 Then ShowWindow wnd, SW_SHOW
End Sub
Public Sub Hidezm() '隐藏桌面
wnd = FindWindow(pr, vbNullString)
wnd = FindWindowEx(wnd, 0, desk, vbNullString)
If wnd <> 0 Then ShowWindow wnd, SW_HIDE
End Sub
Public Sub Showzm()
wnd = FindWindow(pr, vbNullString) '显示桌面
wnd = FindWindowEx(wnd, 0, desk, vbNullString)
If wnd <> 0 Then ShowWindow wnd, SW_SHOW
End Sub
Public Sub Ghmouse(ByVal ctlHwnd As Long) 'ctlHwnd可以传一个控件或窗体
On Error GoTo a:
Dim rectcotr As RECT
Dim rest As Long
GetWindowRect ctlHwnd, rectcotr '取得这个控件的范围矩形
rectcotr.Left = rectcotr.Left
rectcotr.Right = rectcotr.Right
rectcotr.Top = rectcotr.Top
rectcotr.Bottom = rectcotr.Bottom
'设定鼠标的范围
SetCursorPos (rectcotr.Left + rectcotr.Top) / 2, (rectcotr.Bottom + rectcotr.Right) / 2
rest = ClipCursor(rectcotr) '限定鼠标在一个区域
Exit Sub
a:
MsgBox Err.Description
End Sub
Public Sub Shmouse() '恢复鼠标的范围
Dim recscreen As RECT
Dim rest As Long
recscreen.Top = 0
recscreen.Left = 0
recscreen.Right = Screen.Width / Screen.TwipsPerPixelX
recscreen.Bottom = Screen.Height / Screen.TwipsPerPixelY
ClipCursor recscreen
End Sub
- 常用的一组API操作
- 一组路径操作的API
- 储存字符串的一组 API
- 常用HDFS的API操作
- 最常用的API 文件操作 --转
- HDFS常用的文件API操作
- javascript中字符串操作常用的API
- 一组常用的弹出窗口用法总结
- 一组常用的Excel日期函数
- 一组常用的弹出窗口用法
- 一组常用的Excel日期函数
- 一组有用的操作Excel的函数
- 一组有用的操作Excel的函数
- 如何提供一组支持事务的工作流API
- wireshark提供的一组API以供抓包和包分析
- 注册表操作常用API使用
- Java常用基础操作API
- python文件操作常用api
- Recognizer & FS & Filter
- HTML标记大全参考手册
- 数据库无限级目录的实现方法
- Allegro学习笔记 里程碑20070813
- Rootkit 1: Detection Hide Process
- 常用的一组API操作
- ORACLE SQL性能优化系列 (六)
- excel冻结窗格--冻结行列标题
- 小议文件保护和锁定技术
- Ring0Prolog
- ORACLE SQL性能优化系列 (七 )
- jboss配置入门(一)
- Windows内核调试器原理浅析
- 设计模式-工厂模式-工厂模式