Jump to content

Maximize window not working


Recommended Posts

I am trying to maximize a window using the following code for a window that has GENEVA in the title. However, when I run the code, it brings it to the front and therefore Winactivate is working but it does not maximize the screen. Is there anything I am doing wrong or another code to maximize the screen with a specific title?  Thanks. 

 

Opt("WinTitleMatchMode",2)
Opt("CaretCoordMode", 1)
WinActivate("GENEVA")
sleep(1000)
WinsetState("GENEVA","",@SW_MAXIMIZE)

Link to comment
Share on other sites

@KDoc Is it possible to manually maximize the window? There are some windows that won't allow 'normal' maximization, such as if they're created in a non-standard way. Also, are there more than 1 window that match "GENEVA"? What is the program for this window? 

 

Have you tried maybe using WinMove to change the size of the window? If changing the size of it like that doesn't work, then again are you able to change the size of it manually? If you can change the size, would changing the size to @DesktopWidth and @DesktopHeight and moving it to 0,0 work?

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

That didn't work unfortunately.   Its a special Citrix window so you may be right that it is not responding to normal maximize commands.    However, if I click on the title bar, it does show a maximize menu option.  I'll try getting the window position and choosing the dropdown menu to maximize it. 

Link to comment
Share on other sites

You can also try:

#include <WinAPISysWin.au3>
Opt("WinTitleMatchMode",2)
Opt("CaretCoordMode", 1)
run ('Geneva.exe')      ;make sure Geneva is runing
$hGeneva  = WinWait("Geneva", "", 10)   ;waits max 10 sec. for Geneva
ConsoleWrite('WWnd: ' & $hGeneva & @CRLF)
sleep(1000)
$iSuccess =     _WinAPI_MoveWindow($hGeneva, 0, 0, @DesktopWidth, @DesktopHeight)
ConsoleWrite('Success: ' & $iSuccess & @CRLF)

 

Link to comment
Share on other sites

@keashdoc If you're not using it, using the AutoIt Window Info tool is very handy for either getting mouse/window positions, or possibly ControlIDs so you can use the ControlClick or ControlSend function (which are usually more reliable than MouseClick or Send): https://www.autoitscript.com/autoit3/docs/intro/au3spy.htm

There might also be some way for you to 'listen' for window messages to find out what 'message' is sent to the window when you click on its maximize button, and then you can use something like https://www.autoitscript.com/autoit3/docs/libfunctions/_SendMessage.htm to send the message to the window that will maximize it. This is something that is for the most part above my knowledge, and I'm not sure how to go about listening/sniffing for the correct message that the window uses (if there is one, again, it's a bit above me).

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...