Jump to content

Clicking the big red X doesnt close the GUI?


The_Noob
 Share

Recommended Posts

Ok im not totally competant with GUI's, what do i need to add so that when a user clicks the red X that normally closes windows to close the GUI. Its not doing it for mine...

#include <GUIConstants.au3>
sleep(1000)
WinSetOnTop("window", "", 0)


GUICreate("Move",1030,791)
GUISetState (@SW_SHOW)
$lastpos = WinGetPos ( "Move" ) 
$pos = WinGetPos ( "Move" ) 
winactivate("window")
do
$lastpos[0] = $pos[0]
$lastpos[1] = $pos[1]
$lastpos[2] = $pos[2]
$lastpos[3] = $pos[3]
$pos = WinGetPos ( "Move" ) 
 WinMove ( "window", "", $pos[0]+3, $pos[1]+29, $pos[2]-6 , $pos[3]-32 )
if wingetstate("Move") = 15 then
     winactivate("window")
endif
sleep(50)
until 1 = 2

There it is... basically im using the GUI as a frame for another window, but i want it so that when i click the X it closes the "frame". Also, how do i make the GUI resizeable?

Edited by The_Noob
Link to comment
Share on other sites

no sleep needed with GUIGetMsg()

#include <GUIConstants.au3>
Sleep(1000)
WinSetOnTop("window", "", 0)

GUICreate("Move", 1030, 791)
GUISetState(@SW_SHOW)
$lastpos = WinGetPos("Move")
$pos = WinGetPos("Move")
WinActivate("window")
Do
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    $lastpos[0] = $pos[0]
    $lastpos[1] = $pos[1]
    $lastpos[2] = $pos[2]
    $lastpos[3] = $pos[3]
    $pos = WinGetPos("Move")
    WinMove("window", "", $pos[0] + 3, $pos[1] + 29, $pos[2] - 6, $pos[3] - 32)
    If WinGetState("Move") = 15 Then
        WinActivate("window")
    EndIf
Until 1 = 2

8)

NEWHeader1.png

Link to comment
Share on other sites

I would use While/Wend instead... (not that it matters, but I like it :) )

Do a select Case for each button or function in the application, $msg is the actual return from the windowbox.

Try to search the AutoIT manual for GUIGetMsg()... it will tell you how it all works, and more.

#include <GUIConstants.au3>
sleep(1000)
WinSetOnTop("window", "", 0)

GUICreate("Move",1030,791)
GUISetState (@SW_SHOW)
$lastpos = WinGetPos ( "Move" )
$pos = WinGetPos ( "Move" )
winactivate("window")
GUISetState()

While 1
    
    $lastpos[0] = $pos[0]
    $lastpos[1] = $pos[1]
    $lastpos[2] = $pos[2]
    $lastpos[3] = $pos[3]
    $pos = WinGetPos ( "Move" )
    WinMove ( "window", "", $pos[0]+3, $pos[1]+29, $pos[2]-6 , $pos[3]-32 )
    if wingetstate("Move") = 15 then
        winactivate("window")
    endif
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE ; Exitbutton
            ExitLoop
        Case Else
            ; enter other code here
    EndSelect
    sleep(50)
WEnd

damn... second, 1-1 eh valuater?

Edited by jinxter

> there are 10 types of people in the world, those who understand binary and those who don't.

Link to comment
Share on other sites

I would use While/Wend instead... (not that it matters, but I like it :) )

Do a select Case for each button or function in the application, $msg is the actual return from the windowbox.

Try to search the AutoIT manual for GUIGetMsg()... it will tell you how it all works, and more.

damn... second, 1-1 eh valuater?

yea... but your script has better direction

8)

NEWHeader1.png

Link to comment
Share on other sites

maybe....

GUICreate("Move",1030,791,-1,-1,$WS_SIZEBOX)

of course it can be handled in a much better way.... as described in the manual under GUICreate and the GUI Control Styles Appendix.

Edited by jinxter

> there are 10 types of people in the world, those who understand binary and those who don't.

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...