WinSetOnTop funktioniert nicht unter Win.8.1

  • Hallo zusammen,

    mir wurde berichtet das das Tool was unten im Spoiler ist nicht richtig unter Windows 8.1 funktioniert.

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=data\Backround\bbo.ico
    #AutoIt3Wrapper_Outfile=Handelstool.exe
    #AutoIt3Wrapper_Outfile_x64=Handelstool.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseX64=y
    #AutoIt3Wrapper_Res_Fileversion=1.1.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=
    #AutoIt3Wrapper_Res_Language=1031
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <ListviewConstants.au3>
    #include <EditConstants.au3>
    #include <ListboxConstants.au3>
    #include <INet.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("WarenHandelsTool", 750, 330, 520, 10)
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "minimizeForm1")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $PicPet = GUICtrlCreatePic(@Scriptdir & "\data\Backround\Stormdevil.tgx", 0, 0, 750, 330)
    GUICtrlSetState($PicPet, $GUI_DISABLE)
    WinSetOnTop($Form1, "", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $version = "1.1"

    [/autoit] [autoit][/autoit] [autoit]

    Global $fileName = "data\ini\StaedteHandelstool.ini"
    Global $fileNameWare = "data\ini\Waren.ini"
    Dim $towns = getTowns()
    Dim $ware = getWare()

    [/autoit] [autoit][/autoit] [autoit]

    $titel = "Neue Runde es ist genug Zeit"
    $titel1 = "Achtung, die Zeit wird knapp"
    $DauerStd = 1
    $DauerMin = 12
    $DauerSek = 00

    [/autoit] [autoit][/autoit] [autoit]

    Global $DauerGesammt = (60 * 60 * $DauerStd) + (60 * $DauerMin) + $DauerSek

    [/autoit] [autoit][/autoit] [autoit]

    Global $comboAmountWare = 1
    Global $comboAmount = 10
    Dim $combosLeft[$comboAmount][2]
    Dim $combosRight[$comboAmount]
    Dim $comboware [$comboAmountWare][2]
    Dim $comboware1 [$comboAmountWare][2]

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    $Label1 = GUICtrlCreateLabel("", 535, 113, 205, 22)
    GUICtrlSetData($Label1, StringFormat("%02d Std %02d Min %02d Sek", $DauerStd, $DauerMin, $DauerSek))
    GUICtrlSetFont(-1, 14, 600)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($Label1, 0xF0F8FF)
    $Button1 = GUICtrlCreateButton("Timer-Start", 585, 146, 100, 21, $BS_CENTER)
    GUICtrlSetOnEvent(-1, "ButtonTimer1")
    $Button2 = GUICtrlCreateButton("Timer-Stop/Reset", 585, 146, 100, 21, $BS_CENTER)
    GUICtrlSetOnEvent(-1, "ButtonTimer2")
    GUICtrlSetState($Button2, $GUI_HIDE)
    $Button3 = GUICtrlCreateButton("Alles Löschen", 585, 300, 100, 21, $BS_CENTER)
    GUICtrlSetOnEvent(-1, "GuiLoeschen")

    [/autoit] [autoit][/autoit] [autoit]

    Global $hList = GUICtrlCreateList("", 528, 25, 210, 85, $LBS_SORT, $WS_EX_OVERLAPPEDWINDOW)
    GUICtrlSetOnEvent($hList, "itemClicked")
    GUICtrlSetState($hList, $GUI_HIDE)

    [/autoit] [autoit][/autoit] [autoit]

    Global $wList = GUICtrlCreateList("", 542, 211, 180, 75, $LBS_SORT, $WS_EX_OVERLAPPEDWINDOW)
    GUICtrlSetState($wList, $GUI_HIDE)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Von Stadt", 20, 4, 95, 17, $SS_CENTER)
    GUICtrlSetFont(-1, 12, 600)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFE4C4)
    GUICtrlCreateLabel("Nach Stadt", 420, 4, 95, 17, $SS_CENTER)
    GUICtrlSetFont(-1, 12, 600)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0x000000)

    [/autoit] [autoit][/autoit] [autoit]

    Global $currentLabel

    [/autoit] [autoit][/autoit] [autoit]

    #region Combos Stadtauswahl
    Local $abstand = 30
    For $i = 0 To $comboAmount - 1
    $combosLeft[$i][0] = createCombo(20, 25 + $i * $abstand, 95, 25)
    $combosLeft[$i][1] = GUICtrlCreateLabel("", 118, 27 + $i * $abstand, 300, 30, $SS_CENTER)
    GUICtrlSetFont(-1, 11, 600)
    GUICtrlSetColor(-1, 0x000000)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    $combosRight[$i] = createCombo(420, 25 + $i * $abstand, 95, 25)
    GUICtrlSetOnEvent($combosLeft[$i][0], "comboChanged")
    GUICtrlSetOnEvent($COMBOSRIGHT[$I], "DummyChange") ;===> Setzt bei klick Focus auf die Combo $COMBOWARE
    Next
    #endregion Combos Stadtauswahl

    [/autoit] [autoit][/autoit] [autoit]

    #region Combos Warenauswahl
    Local $abstand = 30
    For $i = 0 To $comboAmountWare - 1
    $comboware[$i][0] = createComboo(523, 175 + $i * $abstand, 220, 25)
    $comboware1[$i][1] = GUICtrlCreateLabel("", 250, 10 + $i * $abstand, 100, 15, $SS_LEFT)
    GUICtrlSetState(-1, $GUI_HIDE)
    GUICtrlSetOnEvent($comboware[$i][0], "comboChangedd")
    Next
    #endregion Combos Warenauswahl

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    ; Opt("GUIOnEventMode", 1)
    $Form2 = GUICreate("Form2", 50, 43, 10, 220, $WS_POPUP)
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "minimizeForm2")
    $PicPet1 = GUICtrlCreatePic(@Scriptdir & "\data\Backround\Handelstoolpic.tgx", 0, 0, 50, 43)
    GUICtrlSetState($PicPet1, $GUI_DISABLE)
    GUICtrlCreateButton("Handel",5,13,40,18)
    GUICtrlSetOnEvent(-1, "minimizeForm2")
    GUISetState(@SW_SHOW)
    GUISetState(@SW_MINIMIZE)

    [/autoit] [autoit][/autoit] [autoit]

    #region Function Updatecheck
    InetGet("http://www.bboalmanach.de/HandelsToolUpdate/update.txt", @Scriptdir & "\data\update.txt", 1, 0)
    $file = FileOpen(@Scriptdir & "\data\update.txt", 0)
    $line = FileReadLine($file, 1)
    If $line = $version Then
    FileClose($file)
    Else
    $fg = MsgBox(20, "Es ist eine neue Version vorhanden!", "Möchtest du jetzt Updaten?")
    If $fg = 6 Then
    InetGet("http://www.bboalmanach.de/HandelsToolUpdate/updatetest/HandelsTool.exe", @ScriptDir & "\Update\HandelsTool.exe", 1, 0)
    MsgBox(1, "Update abgeschlossen", "Aktuelle Version (" & $version & ")", 2)
    FileClose($file)
    Run(@ScriptDir & "\Update\HandelsTool.exe")
    Sleep(1500)
    Exit
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    #endregion Function Updatecheck

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Sleep(4000)
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    #region Func Combos Stadt
    Func close()
    _log("Closing programm")
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func minimizeForm1()
    GUISetState(@SW_RESTORE, $Form2)
    WinSetOnTop($Form2, "", 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func minimizeForm2()
    GUISetState(@SW_RESTORE, $Form1)
    GUISetState(@SW_MINIMIZE, $Form2)
    WinSetOnTop($Form1, "", 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func DummyChange();Hier wird der Focus auf die Combo $COMBOWARE[0][0] gesetzt wenn eine Auswahl in den Combos Nach Stadt ausgewählt wurde
    GUICtrlSetState($WLIST, $GUI_FOCUS)
    EndFunc ;==>DummyChange

    [/autoit] [autoit][/autoit] [autoit]

    Func getTowns()
    _log("Reading section names..")
    Local $sectioNames = IniReadSectionNames($fileName)

    [/autoit] [autoit][/autoit] [autoit]

    If (@error) Then
    Local $errorMsg = "Could not open file '" & $fileName & "'."
    _log($errorMsg, True)
    MsgBox(0, "Error", $errorMsg)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _log("Read " & $sectioNames[0] & " section names.")
    Return $sectioNames
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func getItems($town)
    Local $items = IniReadSection($fileName, $town)
    If (@error) Then
    Local $errorMsg = "Could not read section '" & $town & "'."
    _log($errorMsg, True)
    MsgBox(0, "Error", $errorMsg)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $itemAmount = $items[0][0]

    [/autoit] [autoit][/autoit] [autoit]

    _log("Found '" & $itemAmount & "' items for town '" & $town & "'.")
    Local $availableItems
    For $i = 1 To $itemAmount
    $availableItems &= $items[$i][0]
    If ($i < $itemAmount) Then $availableItems &= "|"
    Next
    Return $availableItems
    EndFunc
    #endregion Func Combos Stadt

    [/autoit] [autoit][/autoit] [autoit]

    #region Func Combos Waren
    Func closet()
    _loge("Closing program")
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func getWare()
    _loge("Reading section names..")
    Local $sectioNamesWare = IniReadSectionNames($fileNameWare)
    If (@error) Then
    Local $errorMsg = "Could not open file '" & $fileNameWare & "'."
    _loge($errorMsg, True)
    MsgBox(0, "Error", $errorMsg)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _loge("Read " & $sectioNamesWare[0] & " section names.")
    Return $sectioNamesWare
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func getWareitems($ware)
    Local $itemss = IniReadSection($fileNameWare, $ware)
    If (@error) Then
    Local $errorMsg = "Could not read section '" & $ware & "'."
    _loge($errorMsg, True)
    MsgBox(0, "Error", $errorMsg)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $itemAmountt = $itemss[0][0]

    [/autoit] [autoit][/autoit] [autoit]

    _loge("Found '" & $itemAmountt & "' items for town '" & $ware & "'.")
    Local $availableItemss
    For $i = 1 To $itemAmountt
    $availableItemss &= $itemss[$i][0]
    If ($i < $itemAmountt) Then $availableItemss &= "|"
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Return $availableItemss
    EndFunc
    #endregion Func Combos Waren

    [/autoit] [autoit][/autoit] [autoit]

    Func createCombo($x, $y, $width, $height)
    Local $string
    For $i = 2 To $towns[0]
    $string &= $towns[$i]
    If ($i < $towns[0]) Then $string &= "|"
    Next
    $combo = GUICtrlCreateCombo($towns[1], $x, $y, $width, $height, BitOR($CBS_SORT, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST, $WS_VSCROLL))
    GUICtrlSetData(-1, $string, "")
    GUICtrlSetState(-1, $GUI_NOFOCUS)
    Return $combo
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func createComboo($x, $y, $width, $height)
    Local $string
    For $i = 2 To $ware[0]
    $string &= $ware[$i]
    If ($i < $ware[0]) Then $string &= "|"
    Next
    $combo = GUICtrlCreateCombo($ware[1], $x, $y, $width, $height, BitOR($CBS_SORT, $CBS_AUTOHSCROLL, $CBS_DROPDOWNLIST, $WS_VSCROLL))
    GUICtrlSetData(-1, $string, "")
    GUICtrlSetState(-1, $GUI_Focus)
    GUICtrlSetState($combo, $GUI_SHOW)
    Return $combo
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _log($message, $error = False)
    If ($error) Then
    ConsoleWriteError(@HOUR & ":" & @MIN & ":" & @SEC & @TAB & $message & @CRLF)
    Else
    ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & @TAB & $message & @CRLF)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _loge($message, $error = False)
    If ($error) Then
    ConsoleWriteError(@HOUR & ":" & @MIN & ":" & @SEC & @TAB & $message & @CRLF)
    Else
    ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & @TAB & $message & @CRLF)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func comboChanged()
    _log("Combo " & @GUI_CtrlId & " was selected")
    Local $clickedCombo = -1
    For $i = 0 To UBound($combosLeft)
    If (@GUI_CtrlId == $combosLeft[$i][0]) Then
    $clickedCombo = $combosLeft[$i][0]
    $currentLabel = $combosLeft[$i][1]
    ExitLoop
    EndIf
    Next
    If ($clickedCombo == -1) Then
    _log("Unknown combo was clicked..", True)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $selectedItem = GUICtrlRead($clickedCombo)
    _log("Item " & $selectedItem & " was clicked.")

    [/autoit] [autoit][/autoit] [autoit]

    Local $items = getItems($selectedItem)

    [/autoit] [autoit][/autoit] [autoit]

    If ($items == -1) Then
    _log("Could not retreive items for town '" & $selectedItem & "'", True)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($hList, "")
    GUICtrlSetData($hList, $items)
    GUICtrlSetState($hList, $GUI_SHOW)
    GUICtrlSetState($HLIST, $GUI_FOCUS); Focus auf ListBox $HLIST setzen
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func itemClicked()
    If (@GUI_CtrlId <> $hList) Then
    _log("Unkown callback..", True)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $selectedItem = GUICtrlRead($hList)
    _log("Item '" & $selectedItem & "' in List was clicked")

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState($hList, $GUI_HIDE)
    GUICtrlSetData($currentLabel, $selectedItem)
    EndFunc
    #endregion functions Stadt -------------------------------------------------------------------------------------------------
    Func COMBOCHANGEDDUMMY()
    GUICtrlSetState($WLIST, $GUI_FOCUS); Fokus auf Listbox $WLIST setzen
    EndFunc ;==>COMBOCHANGEDDUMMY
    Func comboChangedd()
    _loge("Combo " & @GUI_CtrlId & " was selected")
    Local $clickedComboo = -1
    For $i = 0 To UBound($comboware)
    If (@GUI_CtrlId == $comboware[$i][0]) Then
    $clickedComboo = $comboware[$i][0]
    $currentLabel = $comboware1[$i][1]
    ExitLoop
    EndIf
    Next
    If ($clickedComboo == -1) Then
    _loge("Unknown combo was clicked..", True)
    Return -1
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $selectedItem = GUICtrlRead($clickedComboo)
    _loge("Item " & $selectedItem & " was clicked.")

    [/autoit] [autoit][/autoit] [autoit]

    Local $itemss = getWareitems($selectedItem)

    [/autoit] [autoit][/autoit] [autoit]

    If ($itemss == -1) Then
    _loge("Could not retreive items for town '" & $selectedItem & "'", True)
    Return -1
    EndIf
    GUICtrlSetData($wList, "")
    GUICtrlSetData($wList, $itemss)
    GUICtrlSetState($wList, $GUI_SHOW)
    GUICtrlSetState($WLIST, $GUI_FOCUS); Fokus auf Listbox $WLIST setzen
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func ButtonTimer1()
    AdlibRegister("_start", 1000)
    GUICtrlSetState($Button1, $GUI_HIDE)
    GUICtrlSetState($Button2, $GUI_SHOW)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func ButtonTimer2()
    AdlibUnRegister("_start")
    Global $DauerGesammt = (60 * 60 * $DauerStd) + (60 * $DauerMin) + $DauerSek
    GUICtrlSetData($Label1, StringFormat("%02d Std %02d Min %02d Sek", $DauerStd, $DauerMin, $DauerSek))
    GUICtrlSetColor($Label1, 0xF0F8FF)
    ToolTip("Restzeit: " & _Sek2StdMinSek($DauerGesammt),175,0,$titel,1)
    GUICtrlSetState($Button1, $GUI_SHOW)
    GUICtrlSetState($Button2, $GUI_HIDE)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _start()
    GUICtrlSetData($Label1, "" & _Sek2StdMinSek($DauerGesammt))
    If $DauerGesammt > 900 Then
    GUICtrlSetColor($Label1, 0xF0F8FF)
    ElseIf $DauerGesammt < 900 Then
    GUICtrlSetColor($Label1, 0xFF0000)
    EndIf
    If $DauerGesammt > 900 Then
    ToolTip("Restzeit: " & _Sek2StdMinSek($DauerGesammt),175,0,$titel,1)
    ElseIf $DauerGesammt < 900 Then
    ToolTip("Restzeit: " & _Sek2StdMinSek($DauerGesammt),175,0,$titel1,2)
    EndIf
    $DauerGesammt = $DauerGesammt - 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Sek2StdMinSek($value)
    $format1 = "%02d:%02d:%02d"
    $format2 = "%02d:%02d"
    $format3 = "%02d Std %02d Min %02d Sek"
    $format4 = "%02d Std. %02d Min."

    [/autoit] [autoit][/autoit] [autoit]

    $std = Floor($value / (60 * 60))
    $value = $value - ((60 * 60) * $std)
    $min = Floor($value / (60))
    $sek = $value - ((60) * $min)

    [/autoit] [autoit][/autoit] [autoit]

    Return StringFormat($format3, $std, $min, $sek)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _toDo()
    AdlibUnRegister("_start") ; Timer beenden
    Exit ; Skript beenden
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func GuiLoeschen()
    GUIDelete($Form1)
    GUIDelete($Form2)
    Run(@ScriptDir & "\Handelstool.exe")
    _toDo()
    Run(@ScriptDir & "\Handelstool.exe")
    EndFunc

    [/autoit]

    Und zwar ist das Programm ( Gui ) eigentlich immer im Vordergrund, hervorgerufen mit WinSetOnTop. Unter Win XP/7 funktioniert dies ohne Probleme, jedoch wie erwähnt nicht unter Win. 8.1.
    Kennt jemand die Behebung für dieses Problem?

    Mfg Ghostleader

  • also ich kann keine Probleme in meinem virtuellen Win8 feststellen
    aber dein Programm hat da so ein Fenster an der Seite was mir unnormal erscheint
    und die Schriftfarbe ist auch sehr suboptimal
    [Blockierte Grafik: http://image.devsome.com/pics/52bf587482c3a.png]
    und das Fenster auf "legalem" wege die metro oberfläche nicht überdecken dürfen ist klar

    mfg MrKrabat

  • Hallo zusammen,

    erst einmal ein gesundes neues Jahr für alle und danke an euch zwei für eure bisherige Hilfe.

    misterspeed
    Habe mir das auf der Seite mal angesehen, aber einerseits sehe ich da net recht durch und anderer seits müste ja, wenn das so funktioniert jeder User für sich machen und das jedem nahe zu bringen ist ja auch net gerade einfach.

    @Krabat
    wenn du das tool offen hast und es vor deinem Arbeitsplatz ist und du wo anders hin klickst, ist denn das Tool dann trotzdem noch vor dem Arbeitsplatz Fenster?
    Diese kleine Gui über deinem Windows Explorer soll dann im Spiel sichtbar sein, wenn die große Haupt GUI minimiert ist, um diese dann darüber wieder zu maximieren.
    Eigentlich soll die kleine nur sichtbar sein wenn das spiel aktiviert ist, jedoch funktioniert das irgendwie nicht richtig denn sie ist immer da wenn das Programm an ist, auch wenn das spiel minimiert ist.
    Ich denke mal es liegt daran, das das spiel im Vollbildmodus nicht mehr als Fenster angesehen wird.
    Normalerweise ist im Hintergrund bei beiden Gui´s ein Bild, dann sehen die Farben besser erkennbar aus.

    Mfg Ghostleader

    Nachtrag:
    Also mein Tester berichtet mir gerade , das es wirklich nur nicht im Vordergrund bei dem Spiel bleibt, aber bei allen anderen geöffneten Fenstern (Windowsseitig) bleibt es im Vordergrund.

    Einmal editiert, zuletzt von Ghostleader (1. Januar 2014 um 13:48)