‘---------------------窗口操作命令-------------------------------------
Function window_move(窗口句柄, x, y) //移动窗口2500,0 将窗口移出屏幕,起到隐藏窗口作用
Call Plugin.Window.move(窗口句柄, 2500, 0)
End Function
Function window_shin(窗口句柄, x, y)
Call Plugin.Window.move(窗口句柄, x, y) //移动窗口至x,y 与上条配合使用恢复窗口
End Function
Function window_hide(窗口句柄)
Call Plugin.Window.Hide(窗口句柄) //隐藏窗口
End Function
Function window_show(窗口句柄)
Call Plugin.Window.Show(窗口句柄) //显示窗口
End Function
Function getwindow_X(窗口句柄) //取窗口宽
Dim srect ,srect0
getwindow_X=0
sRect = Plugin.Window.GetClientRect(窗口句柄)
sRect0 = split(sRect, "|")
getwindow_X = Clng(sRect0(2)) - Clng(sRect0(0))//窗口宽
End Function
Function getwindow_Y(窗口句柄) //取窗口高
Dim srect ,srect0
getwindow_Y=0
sRect = Plugin.Window.GetClientRect(窗口句柄)
sRect0 = split(sRect, "|")
getwindow_Y = Clng(sRect0(3)) - Clng(sRect0(1))//窗口高
End Function
Function getclient_X(窗口句柄) //取窗口用户区X坐标
Dim srect ,srect0
getclient_X=0
sRect = Plugin.Window.GetClientRect(窗口句柄)
sRect0 = split(sRect, "|")
getclient_X = Clng(sRect0(0))//左上角X
End Function
Function getclient_Y(窗口句柄) //取窗口用户区Y坐标
Dim srect ,srect0
getclient_Y=0
sRect = Plugin.Window.GetClientRect(窗口句柄)
sRect0 = split(sRect, "|")
getclient_Y = Clng(sRect0(1))//左上角Y
End Function
Function window_size(窗口句柄, Hwnd2) //取窗口数据 存入全局变量
Dim srect ,srect0
window_size=false
sRect = Plugin.Window.GetClientRect(窗口句柄)
sRect0=split(sRect,"|")
client_X = Clng(sRect0(0))//左上角X
client_Y = Clng(sRect0(1))//左上角Y
client_X2 = Clng(sRect0(2))
client_Y2 = Clng(sRect0(3))
window_x = Clng(sRect0(2)) - Clng(sRect0(0))//窗口宽
window_y = Clng(sRect0(3)) - Clng(sRect0(1))//窗口高
window_xH = window_x / 2
window_yH = window_y / 2
sRect1 = Plugin.Window.GetWindowRect(Hwnd2)
sRect2=split(sRect1,"|")
Hwnd_X = Clng(sRect2(0))
Hwnd_Y = Clng(sRect2(1))
If client_X > 0 Then
日志运行内容 = V_当前程序&"得到窗口数据:" & Hwnd & "[" & client_X & "," & client_Y & "](" & window_x & "," & window_y & ")(" & window_xH & "," & window_yH& ")"
Call 输出日志(日志运行内容):TracePrint 日志运行内容
日志运行内容 = V_当前程序&"得到数据:" & Hwnd_0 & "[" & Hwnd_X & "," & Hwnd_Y & "]"
Call 输出日志(日志运行内容):TracePrint 日志运行内容
window_size=true
Else
window_size=false
End If
End Function
/* 全局变量
client_X = Clng(sRect0(0))//左上角X
client_Y = Clng(sRect0(1))//左上角Y
client_X2 = Clng(sRect0(2))
client_Y2 = Clng(sRect0(3))
window_x = Clng(sRect0(2)) - Clng(sRect0(0))//窗口宽
window_y = Clng(sRect0(3)) - Clng(sRect0(1))//窗口高
window_xH = window_x / 2
window_yH = window_y / 2
Hwnd_X = Clng(sRect2(0))
Hwnd_Y = Clng(sRect2(1))
原文地址:https://blog.51cto.com/12815848/2441497
时间: 2024-11-08 18:02:20