1,486
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private m_WinRectCollection As Collection
'移出并保存坐标
Sub MoveOut(ByVal hWndTarget As Long)
Dim rc As RECT
GetWindowRect hWndTarget, rc
rc.Right = rc.Right - rc.Left 'width
rc.bottom = rc.bottom - rc.Top 'height
If m_WinRectCollection Is Nothing Then
Set m_WinRectCollection = New Collection
End If
m_WinRectCollection.Add rc.Left & "," & rc.Top & "," & rc.Right & "," & rc.bottom, _
"K" & Hex(hWndTarget)
MoveWindow hWndTarget, 10000, 10000, rc.Right, rc.Top, 1
End Sub
'移入并恢复坐标
Sub MoveIn(ByVal hWndTarget As Long)
Dim sKey As String
Dim a() As String
sKey = "K" & Hex(hWndTarget)
a = Split(m_WinRectCollection(sKey), ",")
m_WinRectCollection.Remove sKey
MoveWindow hWndTarget, CLng(a(0)), CLng(a(1)), CLng(a(2)), CLng(a(3)), 1
End Sub
这个是获取多句柄 移动多窗体的代码
Tmp_Hwnd = FindWindow(ByVal 0&, ByVal 0&)
Do While Tmp_Hwnd <> 0
Call GetWindowThreadProcessId(Tmp_Hwnd, Tmp_Pid)
If Tmp_Pid = pid Then
If IsWindowVisible(Tmp_Hwnd) <> 0 Then
GetPidFindHwnd = Tmp_Hwnd
MoveWindow GetPidFindHwnd, 10000, 10000, 10000, 10000, False
End If
End If
Tmp_Hwnd = GetWindow(Tmp_Hwnd, GW_HWNDNEXT)
Loop