Jump to content

The script and GUI don't answer


djbj90
 Share

Recommended Posts

Hi everybody,

I started AutoIt this morning and i have a big problem, i don't find how to solve it.

I looked the doc but maybe i don't look at the right place.

My script does this :

- Run some .exe hidden

- Create a GUI with buttons for show/hide windows associated with these .exe ran.

; Launch the .exe
$WORLD = Run(@ScriptDir & "\Core\WorldLServer Extasis.exe", @ScriptDir & "\Core\", @SW_HIDE)
$MAIN = Run(@ScriptDir & "\Core\MainLServer 496.exe", @ScriptDir & "\Core\", @SW_HIDE)
Sleep(500)

;Create the GUI with buttons
$GUI = GUICreate("Manager", 450, 600, @DesktopWidth - 450) ; don't care of the size, there is 8 .exe in reality

$WORLDLABEL = GUICtrlCreateLabel("World server", 355, 380, 70)
$SHOWWORLD = GUICtrlCreateButton("Show", 335, 400, 50, 30)
$HIDEWORLD = GUICtrlCreateButton("Hide", 385, 400, 50, 30)


$MAINLABEL = GUICtrlCreateLabel("Main Server", 35, 535, 70)
$SHOWMAIN = GUICtrlCreateButton("Show", 15, 555, 50, 30)
$HIDEMAIN = GUICtrlCreateButton("Hide", 65, 555, 50, 30)


GUISetState(@SW_SHOW)

;Main

While 1
     $MSG = GUIGetMsg()
     Switch $MSG
          Case $GUI_EVENT_CLOSE
               Exit

          Case $SHOWWORLD
               $WINDOW = GETWINDOWFROMPID($WORLD)
               WinSetState($WINDOW, "", @SW_SHOW)

          Case $HIDEWORLD
               $WINDOW = GETWINDOWFROMPID($WORLD)
               WinSetState($WINDOW, "", @SW_HIDE)

          Case $SHOWMAIN
               $WINDOW = GETWINDOWFROMPID($MAIN)
               WinSetState($WINDOW, "", @SW_SHOW)

          Case $HIDEMAIN
               $WINDOW = GETWINDOWFROMPID($MAIN)
               WinSetState($WINDOW, "", @SW_HIDE)

     EndSwitch
WEnd


;GETWINDOWFROMPID function


Func GETWINDOWFROMPID($PID)

     $HWND = 0
     $STPID = DllStructCreate("int")

     Do
          $WINLIST2 = WinList()
          For $I = 1 To $WINLIST2[0][0]
               If $WINLIST2[$I][0] <> "" Then
                    DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WINLIST2[$I][1], "ptr", DllStructGetPtr($STPID))
                    If DllStructGetData($STPID, 1) = $PID Then
                         $HWND = $WINLIST2[$I][1]
                         ExitLoop
                    EndIf
               EndIf
          Next
     Sleep(100)
     Until $HWND <> 0

     Return $HWND
EndFunc

So, this script works fine, I have my GUI with buttons show/hide and when i click on them, my windows show/hide.

The problem is :

-> When I show a window, and close it with the red cross, my GUI (and all my script) doesn't answer anymore... I can't clic on show/hide for others windows and I can't even close my GUI with her red cross.

Why ? Do you have anything for solve this ?

Thanks for answers, Sorry for my bad english.

Edited by djbj90
Link to comment
Share on other sites

  • Moderators

djbj90,

Welcome to the AutoIt forum. :)

I suggest you post the code so that we can take a look. Please use Code tags when you do - put [autoit] before and [/autoit] after your posted code - so that you get a scrolling box and syntax colouring which makes the code easier to read. ;)

M23

P.S. Please just use the standard forum font in future - that blue background makes it very hard to read. ;)

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

djbj90,

Would this be a manager for various game servers by any chance? :huh:

Please read the Forum rules (there is also a link at bottom right of each page) and make sure that you are legal. ;)

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

djbj90,

That is immaterial - if the script deals with a game of any description the thread falls foul of the rules and will be closed. :naughty:

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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