Till I get the windows names I can't actually do anything for real.
--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
I just ran some tests and that bloody taskbar .....
So therefore I had to make the program smart (means more work for me) so I can adjust for the taskbar and taskbar position.
Here's the code that does 4 explorer windows (My Comp, My Docs, Recycle Bin, and My Network Places). There's no error checking (it works or it doesn't). Paste into a word macro to test or play with (word will likely have it's own Sub <name>/End Sub already inserted).
Public Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SetWindowPos Lib "User32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SPI_GETWORKAREA = 48
Private Declare Function SystemParametersInfo& Lib "User32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As _
Long, lpvParam As Any, ByVal fuWinIni As Long)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub Main()
Dim DeskMetrics As RECT
Ret = SystemParametersInfo(SPI_GETWORKAREA, 0, DeskMetrics, 0)
WinHeight = (DeskMetrics.Bottom - DeskMetrics.Top) / 2
WinWidth = (DeskMetrics.Right - DeskMetrics.Left) / 2
hwindows = FindWindow(vbNullString, "My Computer")
Ret = SetWindowPos(hwindows, 0, DeskMetrics.Left, DeskMetrics.Top, WinWidth, WinHeight, 0)
hwindows = FindWindow(vbNullString, "My Documents")
Ret = SetWindowPos(hwindows, 0, DeskMetrics.Left + WinWidth + 1, DeskMetrics.Top, WinWidth, WinHeight, 0)
hwindows = FindWindow(vbNullString, "Recycle Bin")
Ret = SetWindowPos(hwindows, 0, DeskMetrics.Left, DeskMetrics.Top + WinHeight + 1, WinWidth, WinHeight, 0)
hwindows = FindWindow(vbNullString, "My Network Places")
Ret = SetWindowPos(hwindows, 0, DeskMetrics.Left + WinWidth + 1, DeskMetrics.Top + WinHeight + 1, WinWidth, WinHeight, 0)
End Sub
Because you have to give it time for the windows to get formed
1/ the program can start then wait for the window.
2/ You can click manually after the windows have had time to form.
--
----------------------------------------------------------
http://www.g2mil.com/Dec2003.htm
So something like
0, 0, 640, 512
0, 513, 640, 512
641, 0, 640, 512
641, 513, 640, 512
The full and exact window title is critical