jantograaf Posted April 23, 2018 Posted April 23, 2018 Hi all, I'm trying to write a script that shows a window when it's in background mode and maximizes that same window when it's hidden. This script is activated by a button in another program which runs in always-on-top-mode, hence the WinSetOnTop-functionality. When the window that has to be activated is in the background, it gets the focus as should and all works perfectly. When the window I need to activate is minimized, it gets restored but not maximized. However, if I uncomment my line of code (the MsgBox), the state returned is 47, which should be a maximized, active window. Any ideas? Any help would be appreciated. I have tried some workarounds using @SW_RESTORE and then @SW_MAXIMIZE but to no avail. Also, I can't maximize it using a hardcoded resolution since some of our clients will use this app on a dual- or triple-screen setup. In attached screenshot, you will see both applications. The VSOL-button in the background app should open the foreground app in maximized mode. The 'Ga naar FUJI'-button in the VSOL-app minimizes the VSOL-application to return to the FUJI-one. The VSOL-application is programmed using the Electron Framework (Chrome_Widget_Win browser window). I'm looking forward to all input/remarks. My coding isn't quite up to par yet. :-) Kind regards, Jan Opt("WinTitleMatchMode",-2) If WinExists("Vsol app","") Then Local $VSOLHandle = WinGetHandle("Vsol app","") WinSetOnTop($VSOLHandle,"",$WINDOWS_ONTOP) If BitAND (WinGetState($VSOLHandle,""),16) Then ;Check if the window is minimized WinActivate($VSOLHandle,"") WinWaitActive($VSOLHandle,"",5) WinSetState($VSOLHandle,"",@SW_MAXIMIZE) ;MsgBox(48,"WinGetState",WinGetState("Vsol app","")) Else WinSetState($VSOLHandle,"",@SW_SHOW) EndIf WinSetOnTop($VSOLHandle,"",$WINDOWS_NOONTOP) Else Run("C:\VSOL4\vsol-app\main.exe") Sleep(10000) EndIf
islandspapand Posted April 25, 2018 Posted April 25, 2018 Maybe you can use GUISetState(@SW_MAXIMIZE, $VSOLHandle) in sted of WinSetState
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now