Sign in to follow this  
Followers 0
Delta01

GUI won't work

3 posts in this topic

#1 ·  Posted (edited)

Hi,

Well, I'm making an AutoIt code and it's my first to deal with GUI's. But i'm having a problem, I have my GUI so that it has 4 buttons, Close the program (kill), minimizer the program, maximize the program and Close, to close the script.

The close and the kill button work fine, it's the other 2 that don't. I had hotkeys set up to minimize/maximize and they worked perfectly, so i used the same code and added it to the GUI, but it doesn't work.

$main = GUICreate("----", 146, 150)
$Kill = GUICtrlCreateButton("Kill Program", 35, 12, 80, 25)
$Hide = GUICtrlCreateButton("Minimize Program", 35, 37, 80, 25)
$Show = GUICtrlCreateButton("Maximize Program", 35, 63, 80, 25)
$Close = GUICtrlCreateButton("Close script", 35, 88, 80, 25)
GuiCtrlCreateLabel("Made by ----©", 58, 135)
GuiSetstate()
    
    
While 1
    $GuiControl = GUIGetMsg()

    If $GuiControl = $Close then Exit
        
    If $GuiControl = $Kill then
    If ProcessExists("xxxxx") then sleep(20)
    ProcessClose("xxxxx")
    
    If $GuiControl = $Hide then
    WinSetState("xxxxx", "", @SW_MINIMIZE)
    WinSetState("xxxxx", "", @SW_HIDE)
    
    If $GuiControl = $Show Then
    WinSetState("xxxxx", "", @SW_SHOW) 
    WinSetState("xxxxx", "", @SW_RESTORE)
    EndIf
EndIf
Endif
Endif
    WEND

Does anybody know what's wrong?

Edited by Delta01

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>
$main = GUICreate("----", 146, 150)
$Kill = GUICtrlCreateButton("Kill Program", 35, 12, 80, 25)
$Hide = GUICtrlCreateButton("Minimize Program", 35, 37, 80, 25)
$Show = GUICtrlCreateButton("Maximize Program", 35, 63, 80, 25)
$Close = GUICtrlCreateButton("Close script", 35, 88, 80, 25)
GuiCtrlCreateLabel("Made by ----©", 58, 135)
GuiSetstate()
    
While 1
    $GuiControl = GUIGetMsg()

    If $GuiControl = $Close then Exit   
    If $GuiControl = $Kill then
         If ProcessExists("xxxxx") then
               sleep(20)
               ProcessClose("xxxxx")
         EndIf
    EndIf
    If $GuiControl = $Hide then
         WinSetState("xxxxx", "", @SW_MINIMIZE)
         WinSetState("xxxxx", "", @SW_HIDE)
    EndIf
    If $GuiControl = $Show Then
        WinSetState("xxxxx", "", @SW_SHOW) 
        WinSetState("xxxxx", "", @SW_RESTORE)
    EndIf
WEND

Share this post


Link to post
Share on other sites

Ok, It works perfect now. Thanks a ton!

Share this post


Link to post
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
Sign in to follow this  
Followers 0