Jump to content

Recommended Posts

Posted (edited)

I'm pretty sure all autoit  gurus here will have an answer for me :-)

so here the code :

#include <guiconstants.au3>
#include <constants.au3>



func wndMinimize()
   guiSetState( @SW_MINIMIZE, $gui )
endfunc

func wndMaximize()
   guiSetState( @SW_MAXIMIZE, $gui )
endfunc

func wndRestore()
   guiSetState( @SW_RESTORE, $gui )
endfunc

func wndClose()
  exit
endfunc


opt( "GUIOnEventMode", 1)


$flag = bitOr( $WS_SYSMENU, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)
;$flag = 0
$gui = guiCreate( "Hello World", 200, 200, 200, 200, $flag )


guiSetOnEvent( $GUI_EVENT_MINIMIZE, "wndMinimize" )
guiSetOnEvent( $GUI_EVENT_MAXIMIZE, "wndMaximize" )

guiSetOnEvent( $GUI_EVENT_RESTORE, "wndRestore" )

guiSetOnEvent( $GUI_EVENT_CLOSE, "wndClose" )

guiSetState( @SW_SHOW )
while 1
   sleep( 1000 )
wend

I basicly just redefine Minize, Maximize, Restore and Close ...  because in my application I will need to do some stuff in there ....

but here the problem,   script start and display a hello world,  if I minimize it, and click on the icon on the task bar( actually restoring it )  the restore works fine, window is at the right place...

but if I maximine the window and minimize it , the restore bring back a window NOT maximized !

if you comment out  this line

guiSetOnEvent( $GUI_EVENT_RESTORE, "wndRestore" )

and let windoze do the restore a maximized window minimized in the task bar will be restore as a maximized window,  so do you think ? ...

maybe there is a "bug" in the  "guiSetState( @SW_RESTORE, $gui )" ...

:-)

Edited by JoeCool
  • Moderators
Posted

JowCool,

Just add

Opt("GUIEventOptions", 1)
to your code - it then works as you expect. :)

If you want to code for the window events, best you stop Windows doing its own thing at the same time. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

JoeCool,

I have also closed the Trac ticket you opened - perhaps a little prematurely. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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