Focus on window not visible on screen
Hello,
I'm testing an application (delphi) and every time I press F12, I get a new window which helps me navigate in the application (note that both the application and the window are part of the same process, which is why minimizing does not show the window). My issue is that when it is done enough times, the window appears behind the application. From what the devs told me, I have to change the window Z order to make it visible on screen.
I have tried multiple things, but the object always says visible = true, while visibleOnScreen = false. Any idea how can I change the z order of application windows or even better, make my window visible again ?
Well, I see...
Ages ago I used this function (VBScript) to put on top some form. (Actually - window registered in Windows.) Hope, it might inspire you with some ideas.
'------------------------------------------------------------------------------- Sub ActivateForm(ByVal strClassName, ByVal strWindowTitle) Const cProcName = "ActivateForm(): " Dim hWnd Dim dwLastError hWnd = Win32API.FindWindow(strClassName, strWindowTitle & " [Shared]") If (0 = hWnd) Then hWnd = Win32API.FindWindow(strClassName, strWindowTitle & " [Personal]") If (0 = hWnd) Then Log.Error cProcName & "Window was not found", "Window class name: " & strClassName & _ vbCrLf & "Window title: " & strWindowTitle End If End If ' If (0 = Win32API.BringWindowToTop(hWnd)) Then If (0 = Win32API.SetWindowPos(hWnd, Win32API.HWND_TOPMOST, 0, 0, 0, 0, Win32API.SWP_NOSIZE)) Then dwLastError = Win32API.GetLastError() Log.Error cProcName & "Window was not activated.", "Window class name: " & strClassName & _ vbCrLf & "Window title: " & strWindowTitle & vbCrLf & _ "System error code: " & dwLastError & vbCrLf & "System error message: " & _ Utilities.SysErrorMessage(dwLastError) End If End Sub '-------------------------------------------------------------------------------