ich hab ja diverse probleme mit AUTOIT, aber was mich neben regex zur verzweifling bringt ist der ganze childgui kram.
Childgui ist für mich wie ein blinker mit 3 stufen.
geht, geht ein bisschen und geht nicht.
zum script....
ich habe ein fenster das per button eine childgui öfnet. soweit so gut.
in der childgui habe ich 6 buttons und wenn ich eine funtion drauf lege, dann geht das auch.
will ich die childgui schliessen geht das auch, ABER....
1. die MainGUI hüpft in den hintergrund.
2. Die MainGUI ist nicht mehr ansprechbar und lässt sich nicht schliessen
hier nun ein funktionstüchtiger ausschnitt der genau das verhalten an den tag legt.
[hide]
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <Array.au3>
#include <Constants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <Misc.au3>
#include <ScrollBarConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <_GetFile.au3>
#region Var
Global $sIni = @ScriptDir & "\Settings.opt"
Global $filefoldername[1]
$APKfolder = "nix"
#endregion Var
If Not FileExists($sIni) Then
Global $sCMDLine = FileSelectFolder("Choose your starting folder.", "")
$iMsgBoxAnswer = MsgBox(270372, "Default?", "Do you want to save this folder for the next Time you use this tool?")
Select
Case $iMsgBoxAnswer = 6 ;Yes
IniWrite($sIni, "APKTOOL", "Path", $sCMDLine)
Case $iMsgBoxAnswer = 7 ;No
EndSelect
Else
$sCMDLine = IniRead($sIni, "APKTOOL", "Path", "Path not Found")
EndIf
#region GUI init CMD init
$hGUI = GUICreate("Test", 800, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$PID = Run(@ComSpec & " /k CD " & $sCMDLine, "", @SW_HIDE)
$hWnd = 0
$stPID = DllStructCreate("int")
Do
$WinList = WinList()
For $i = 1 To $WinList[0][0]
If $WinList[$i][0] <> "" Then
DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
If DllStructGetData($stPID, 1) = $PID Then
$hWnd = $WinList[$i][1]
ExitLoop
EndIf
EndIf
Next
Sleep(100)
Until $hWnd <> 0
$stPID = 0
If $hWnd <> 0 Then
$nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
$nExStyle = $nExStyle[0]
DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOR($nExStyle, $WS_EX_MDICHILD))
DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $hGUI)
WinSetState($hWnd, "", @SW_SHOW)
WinMove($hWnd, "", 0, 0, 720, 420)
EndIf
#endregion GUI init CMD init
#region GUI conrtols
Global Const $iStartx = 610, $iBtnWidth = 100, $iStarty = 10
Global Const $idButton_Setup = GUICtrlCreateButton("Setup APKTool", $iStartx + 85, $iStarty + 270, $iBtnWidth, 40)
Global Const $idButton_Exit = GUICtrlCreateButton("Exit", $iStartx + 85, $iStarty + 315, $iBtnWidth, 40)
GUISetState()
#endregion GUI conrtols
#region Buttonaction
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idButton_Exit
_GDIPlus_Shutdown()
GUIDelete()
ProcessClose($PID)
Exit
Case $idButton_Setup
_apktoolsettings()
EndSwitch
WEnd
#endregion Buttonaction
#region Functions
Func _apktoolsettings()
GUISetState(@SW_DISABLE, $hGUI)
$child_GUI = GUICreate("Child GUI", 274, 101, 470, 212, BitOR($GUI_SS_DEFAULT_GUI, $WS_CHILD))
$Button1 = GUICtrlCreateButton("Load actual apktool.jar", 5, 5, 129, 25)
$Button2 = GUICtrlCreateButton("Load actual aapt.exe", 5, 35, 129, 25)
$Button3 = GUICtrlCreateButton("Load 2.apk - 5.apk", 4, 65, 129, 25)
$Button4 = GUICtrlCreateButton("Button1", 140, 5, 129, 25)
$Button5 = GUICtrlCreateButton("Load actual aapt", 140, 35, 129, 25)
$Button6 = GUICtrlCreateButton("Button 6", 140, 65, 129, 25)
GUISetState(@SW_SHOW)
While 2
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete($child_GUI)
GUISetState(@SW_ENABLE, $hGUI)
Case $Button1
ProgressOn("Download", "Downloading...", "0%")
$url = "http://miui.connortumbleson.com/other/apktool/apktool_1.5.2.jar" ;Set URL
$folder = @ScriptDir & "\apktool_1.5.2.jar" ;Set folder
$hInet = InetGet($url, $folder, 1, 1) ;Forces a reload from the remote site and return immediately and download in the background
$FileSize = InetGetSize($url) ;Get file size
While Not InetGetInfo($hInet, 2) ;Loop until download is finished
Sleep(500) ;Sleep for half a second to avoid flicker in the progress bar
$BytesReceived = InetGetInfo($hInet, 0) ;Get bytes received
$Pct = Int($BytesReceived / $FileSize * 100) ;Calculate percentage
ProgressSet($Pct, $Pct & "%") ;Set progress bar
WEnd
ProgressOff()
Case $Button2
Case $Button3
Case $Button4
Case $Button5
Case $Button6
EndSwitch
WEnd
EndFunc ;==>_apktoolsettings
[/hide]
warum ist das so?
wie muss das richtig sein?
wie kann ich das für immer umgehen?