This method launches a couple of instances of Notepad ans obtains a handle to their window, without enumering:
Private Sub DoLogFiles(ByRef rarrFiles() As String)
Dim lngFile As Integer
Dim rcClient As RECT, rcWnd As RECT
Dim si As STARTUPINFO, pi As PROCESS_INFORMATION, guii As GUITHREADINFO
'//Check if the array is not empty:
Err.Clear
On Error Resume Next
lngFile = UBound(rarrFiles) '//This will result in an error if the array is empty.
If Err.Number > 0 Then Exit Sub
'//Ok, so it's not empty:
On Error GoTo ErrHandler
'//First ask if the user is interested in viewing the logfiles:
If g_clsApp.Application.Message(hWnd, g_clsApp.Term.String(TERM_MSG_VIEWLOGS, CVar("Would you like to see the log files now ?"

), IDS_HDR_MSGBOX, edlgQueryYesNo) = edlgRetNo Then Exit Sub
'//Create new processes for the logfiles to be shown in Notepad:
If Not (GetWindowRect(hWnd, rcWnd) > 0 And GetClientRect(hWnd, rcClient) > 0) Then Exit Sub
'//Initialize startup information:
si.cb = Len(si)
si.lpDesktop = vbNullString
si.lpReserved = vbNullString
si.lpTitle = vbNullString
'//Set size of GUI info structure:
guii.cbSize = Len(guii)
For lngFile = LBound(rarrFiles) To UBound(rarrFiles)
'//Set size and position of the new window:
si.dwXSize = rcClient.right - rcClient.left
si.dwYSize = rcClient.bottom - rcClient.top
si.dwX = rcWnd.left + ((rcWnd.right - rcWnd.left - rcClient.right - rcClient.left) / 2)
si.dwY = rcWnd.bottom - si.dwYSize - ((rcWnd.right - rcWnd.left - rcClient.right - rcClient.left) / 2)
If CreateProcess(vbNullString, "Notepad.exe " & Chr(34) & rarrFiles(lngFile) & Chr(34), 0, 0, 0, NORMAL_PRIORITY_CLASS, 0, vbNullString, si, pi) > 0 Then
'//Wait until the window has been created:
WaitForInputIdle pi.hProcess, INFINITE
'//Set the size and position of the new window:
If GetGUIThreadInfo(pi.dwThreadId, guii) > 0 Then
MoveWindow guii.hwndActive, rcWnd.left + ((rcWnd.right - rcWnd.left - rcClient.right - rcClient.left) / 2), _
rcWnd.bottom - si.dwYSize - ((rcWnd.right - rcWnd.left - rcClient.right - rcClient.left) / 2), _
rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, 1
GetWindowRect guii.hwndActive, rcWnd
GetClientRect guii.hwndActive, rcClient
End If
End If
Next lngFile
On Error GoTo 0
Exit Sub
ErrHandler:
HandleError g_clsApp.Application, CreateErrObject(Err)
End Sub
Greetings,
Rick