Neue Menü für Einstellungen

  • Hi,

    Ich habe ein Menü erstellt das sich E. nennt und da ein Menuitem was sich Einstellungen nennt. wenn man auf das Menuitem Einstellungen klickt soll sich ein neues Fenster öffnen. Dort soll man mehrere sachen auswählen und einstellen können die dann in das Hauptfenster übernommen werden. Nur leider weiß ich nicht wie man so ein Fenster erstellt. :(

    Ich haffe ihr könnt mir helfen.

    MfG
    Sascha :)

    Einmal editiert, zuletzt von Xilent (1. September 2010 um 21:28)

  • Bidde :)

    Spoiler anzeigen

    #include <GuiConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <INet.au3>
    #include <Date.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    ;----------------------------------
    #region
    ; GUI
    $title = "Red Dragon Tool"
    $font="Times New Roman FETT"
    $font2="Times New Roman FETT KURSIV"
    $PublicIP = _GetIP()
    $username = @UserName
    $osversion = @OSVersion & " , " & @OSType & " , " & @OSArch & " , " & @OSBuild
    GuiCreate($title, 300, 380)
    GUISetBkColor(0xff0000)
    Global $lblCpuPer
    ;-----------------------
    ; GROUP WITH RADIO BUTTONS
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) ; auf den klassischen Style umschalten
    $g_1 = GuiCtrlCreateGroup("Spiele", 170, 25, 80, 150)
    GUICtrlSetFont (-1,8.5, -1, -1, $font)
    $g_2 = GuiCtrlCreateGroup("Infos", 50, 175, 200, 135)
    GUICtrlSetFont (-1,8.5, -1, -1, $font)
    ;---------------------------------------------
    $Spiel_1 = GuiCtrlCreateRadio("Cabal", 180, 40, 55)
    ;---------------------------------------------
    $spiel_2 = GuiCtrlCreateRadio("CSS", 180, 60, 55)
    ;---------------------------------------------
    $spiel_3 = GuiCtrlCreateRadio("C.A.", 180, 80, 55)
    ;---------------------------------------------
    $spiel_4 = GuiCtrlCreateRadio("Shift", 180, 100, 55)
    ;---------------------------------------------
    $spiel_5 = GuiCtrlCreateRadio("Alien S.", 180, 120, 55)
    ;---------------------------------------------
    $spiel_6 = GuiCtrlCreateRadio("Pinball", 180, 140, 55)
    ;---------------------------------------------
    GUICtrlCreateGroup ("",-99,-99,1,1) ;close group
    #AutoIt3Wrapper_UseX64=n
    ;-----------------------
    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20
    ;-----------------------

    Global $blink = True
    $Label1 = GUICtrlCreateLabel("", 55, 195, 100, 12)
    $Label2 = GUICtrlCreateLabel("", 55, 210, 100, 12)
    ;---------------------------------------Datum
    _date()

    GUISetState(@SW_SHOW)

    AdlibRegister("_date", 500)
    ;---------------------------------------Uhr
    _time()

    ;GUISetState(@SW_SHOW)

    AdlibRegister("_time", 500)
    ;-------------------------------------
    ;Label
    $L_1 = GuiCtrlCreateLabel("Red Dragon", 50, 25,120)
    GUICtrlSetFont (-1,11, -1, -1, $font2)
    $L_2 = GuiCtrlCreateLabel("Tool", 50, 40,100,12)
    GUICtrlSetFont (-1,10, -1, -1, $font2)
    $L_3 = GuiCtrlCreateLabel("IP: " & $PublicIP, 55, 280,100,12)
    $L_4 = GuiCtrlCreateLabel($username, 55, 230,100,12)
    $L_5 = GuiCtrlCreateLabel($osversion, 55, 295,175,12)
    $L_6 = GuiCtrlCreateLabel("CPU Kerne: " & _GetCoreCount(), 55, 250,175,12)
    $lblCpuPer = GuiCtrlCreateLabel("CPU Auslastng: " & CpuAuslastung(), 55, 265,100,12)
    AdlibRegister("_ShowCpuPer",2500)

    ; (c)
    $c = GuiCtrlCreateLabel("© Xilent", 120, 345,100,12)
    ;-----------------------------------------------------------------------------------------------------------------
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) ; zurück zum Standard-Windowsstyle
    #endregion


    ; BUTTON
    $button_1 = GuiCtrlCreateButton("OK", 50, 315, 100)
    $button_2 = GuiCtrlCreateButton("Schließen", 150, 315, 100)

    $button_3 = GuiCtrlCreateButton("C:\ (Windows)", 50, 75, 100)
    $button_4 = GuiCtrlCreateButton("D:\ (Filme)", 50, 100, 100)
    $button_5 = GuiCtrlCreateButton("E:\ (Musik)", 50, 125, 100)
    $button_6 = GuiCtrlCreateButton("F:\ (Daten)", 50, 150, 100)
    ;Menü
    $Menu1 = GUICtrlCreateMenu ("Ausschalten")
    $Menu1_1 = GUICtrlCreateMenuitem ("Herrunterfahren", $Menu1)
    $Menu1_2 = GUICtrlCreateMenuitem ("Ruhezustand", $Menu1)
    $Menu1_3 = GUICtrlCreateMenuitem ("Neustarten", $Menu1)
    ;---------
    $Menu2 = GUICtrlCreateMenu ("Win7 Style")
    $Menu2_1 = GUICtrlCreateMenuitem ("Aero", $Menu2)
    $Menu2_2 = GUICtrlCreateMenuitem ("Glow Air Final", $Menu2)
    $Menu2_3 = GUICtrlCreateMenuitem ("Windows 7 Black Transparent", $Menu2)
    ;---------
    $Menu3 = GUICtrlCreateMenu ("H. Farbe")
    $Menu3_1 = GUICtrlCreateMenuitem ("Rot", $Menu3)
    $Menu3_2 = GUICtrlCreateMenuitem ("Blau", $Menu3)
    $Menu3_3 = GUICtrlCreateMenuitem ("Gelb", $Menu3)
    $Menu3_4 = GUICtrlCreateMenuitem ("Schwarz", $Menu3)
    $Menu3_5 = GUICtrlCreateMenuitem ("Grün", $Menu3)
    $Menu3_6 = GUICtrlCreateMenuitem ("Pink", $Menu3)
    $Menu3_7 = GUICtrlCreateMenuitem ("Violett", $Menu3)
    $Menu3_8 = GUICtrlCreateMenuitem ("Braun", $Menu3)
    $Menu3_9 = GUICtrlCreateMenuitem ("Weiß", $Menu3)
    $Menu3_r = GUICtrlCreateMenuitem ("Random", $Menu3)
    ;---------
    $Menu4 = GUICtrlCreateMenu ("S. Farbe")
    $Menu4_1 = GUICtrlCreateMenuitem ("Rot", $Menu4)
    $Menu4_2 = GUICtrlCreateMenuitem ("Blau", $Menu4)
    $Menu4_3 = GUICtrlCreateMenuitem ("Gelb", $Menu4)
    $Menu4_4 = GUICtrlCreateMenuitem ("Schwarz", $Menu4)
    $Menu4_5 = GUICtrlCreateMenuitem ("Grün", $Menu4)
    $Menu4_6 = GUICtrlCreateMenuitem ("Pink", $Menu4)
    $Menu4_7 = GUICtrlCreateMenuitem ("Violett", $Menu4)
    $Menu4_8 = GUICtrlCreateMenuitem ("Braun", $Menu4)
    $Menu4_9 = GUICtrlCreateMenuitem ("Weiß", $Menu4)
    ;---------
    $Menu5 = GUICtrlCreateMenu ("E.")
    $Menu5_1 = GUICtrlCreateMenuitem ("Einstellungen", $Menu5)


    ; GUI MESSAGE LOOP
    GuiSetState()
    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $button_1
    If $Spiel_1 And GUICtrlRead($Spiel_1) = $GUI_CHECKED Then
    Run("C:\Program Files\Games-Masters.com\CABAL Online (EU)\cabal.exe")
    ElseIf $Spiel_2 And GUICtrlRead($Spiel_2) = $GUI_CHECKED Then
    Run("C:\Program Files\Counter-Strike Source\hl2.exe -game cstrike -nojoy -noipx -console")
    ElseIf $Spiel_3 And GUICtrlRead($Spiel_3) = $GUI_CHECKED Then
    Run("C:\Nexon\Combat Arms EU\CombatArms.exe")
    ElseIf $Spiel_4 And GUICtrlRead($Spiel_4) = $GUI_CHECKED Then
    Run("C:\Program Files\Electronic Arts\Need for Speed SHIFT\shift.exe")
    ElseIf $Spiel_5 And GUICtrlRead($Spiel_5) = $GUI_CHECKED Then
    Run("C:\Users\Sascha\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Steam")
    ElseIf $Spiel_6 And GUICtrlRead($Spiel_6) = $GUI_CHECKED Then
    Run("C:\Program Files\Microsoft Games\Pinball\PINBALL.exe")
    EndIf
    Case $msg = $button_2
    Exit
    Case $msg = $button_3
    Run(@ComSpec & " /c " & 'start C:\', "", @SW_HIDE)
    Case $msg = $button_4
    Run(@ComSpec & " /c " & 'start D:\', "", @SW_HIDE)
    Case $msg = $button_5
    Run(@ComSpec & " /c " & 'start E:\', "", @SW_HIDE)
    Case $msg = $button_6
    Run(@ComSpec & " /c " & 'start F:\', "", @SW_HIDE)
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    Case $msg = $Menu3_1
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xff0000)
    Case $msg = $Menu3_2
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x0000FF)
    Case $msg = $Menu3_3
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xFFFF00)
    Case $msg = $Menu3_4
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x000000)
    Case $msg = $Menu3_5
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x00FF00)
    Case $msg = $Menu3_6
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xFF00FF)
    Case $msg = $Menu3_7
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x800080)
    Case $msg = $Menu3_8
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x800000)
    Case $msg = $Menu3_9
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xFFFFFF)
    Case $msg = $Menu3_r
    AdlibRegister("_Random_BG", 1000)
    _Random_BG()
    Case $msg = $Menu2_1
    Run(@ComSpec & " /c " & 'start C:\Windows\Resources\Themes\Aero.theme', "", @SW_HIDE)
    Case $msg = $Menu2_2
    Run(@ComSpec & " /c " & 'start C:\Windows\Resources\Themes\Glow_Air_Final.theme', "", @SW_HIDE)
    Case $msg = $Menu2_3
    Run(@ComSpec & " /c " & 'start C:\Windows\Resources\Themes\W7BT.theme', "", @SW_HIDE)
    Case $msg = $Menu1_1
    Run(@ComSpec & " /c " & 'shutdown /p', "", @SW_HIDE)
    Case $msg = $Menu1_2
    Run(@ComSpec & " /c " & 'shutdown /h', "", @SW_HIDE)
    Case $msg = $Menu1_3
    Run(@ComSpec & " /c " & 'shutdown /r', "", @SW_HIDE)
    Case $msg = $Menu4_1
    Guictrlsetcolor($L_1, 0xFF0000)
    Guictrlsetcolor($L_2, 0xFF0000)
    Guictrlsetcolor($L_3, 0xFF0000)
    Guictrlsetcolor($L_4, 0xFF0000)
    Guictrlsetcolor($L_5, 0xFF0000)
    Guictrlsetcolor($L_6, 0xFF0000)
    Guictrlsetcolor($Label1, 0xFF0000)
    Guictrlsetcolor($Label2, 0xFF0000)
    Guictrlsetcolor($lblCpuPer, 0xFF0000)
    Guictrlsetcolor($g_1, 0xFF0000)
    Guictrlsetcolor($g_2, 0xFF0000)
    Guictrlsetcolor($Spiel_1, 0xFF0000)
    Guictrlsetcolor($Spiel_2, 0xFF0000)
    Guictrlsetcolor($Spiel_3, 0xFF0000)
    Guictrlsetcolor($Spiel_4, 0xFF0000)
    Guictrlsetcolor($Spiel_5, 0xFF0000)
    Guictrlsetcolor($Spiel_6, 0xFF0000)
    Guictrlsetcolor($c, 0xFF0000)
    Case $msg = $Menu4_2
    Guictrlsetcolor($L_1, 0x0000FF)
    Guictrlsetcolor($L_2, 0x0000FF)
    Guictrlsetcolor($L_3, 0x0000FF)
    Guictrlsetcolor($L_4, 0x0000FF)
    Guictrlsetcolor($L_5, 0x0000FF)
    Guictrlsetcolor($L_6, 0x0000FF)
    Guictrlsetcolor($Label1, 0x0000FF)
    Guictrlsetcolor($Label2, 0x0000FF)
    Guictrlsetcolor($lblCpuPer, 0x0000FF)
    Guictrlsetcolor($g_1, 0x0000FF)
    Guictrlsetcolor($g_2, 0x0000FF)
    Guictrlsetcolor($Spiel_1, 0x0000FF)
    Guictrlsetcolor($Spiel_2, 0x0000FF)
    Guictrlsetcolor($Spiel_3, 0x0000FF)
    Guictrlsetcolor($Spiel_4, 0x0000FF)
    Guictrlsetcolor($Spiel_5, 0x0000FF)
    Guictrlsetcolor($Spiel_6, 0x0000FF)
    Guictrlsetcolor($c, 0x0000FF)
    Case $msg = $Menu4_3
    Guictrlsetcolor($L_1, 0xFFFF00)
    Guictrlsetcolor($L_2, 0xFFFF00)
    Guictrlsetcolor($L_3, 0xFFFF00)
    Guictrlsetcolor($L_4, 0xFFFF00)
    Guictrlsetcolor($L_5, 0xFFFF00)
    Guictrlsetcolor($L_6, 0xFFFF00)
    Guictrlsetcolor($Label1, 0xFFFF00)
    Guictrlsetcolor($Label2, 0xFFFF00)
    Guictrlsetcolor($lblCpuPer, 0xFFFF00)
    Guictrlsetcolor($g_1, 0xFFFF00)
    Guictrlsetcolor($g_2, 0xFFFF00)
    Guictrlsetcolor($Spiel_1, 0xFFFF00)
    Guictrlsetcolor($Spiel_2, 0xFFFF00)
    Guictrlsetcolor($Spiel_3, 0xFFFF00)
    Guictrlsetcolor($Spiel_4, 0xFFFF00)
    Guictrlsetcolor($Spiel_5, 0xFFFF00)
    Guictrlsetcolor($Spiel_6, 0xFFFF00)
    Guictrlsetcolor($c, 0xFFFF00)
    Case $msg = $Menu4_4
    Guictrlsetcolor($L_1, 0x000000)
    Guictrlsetcolor($L_2, 0x000000)
    Guictrlsetcolor($L_3, 0x000000)
    Guictrlsetcolor($L_4, 0x000000)
    Guictrlsetcolor($L_5, 0x000000)
    Guictrlsetcolor($L_6, 0x000000)
    Guictrlsetcolor($Label1, 0x000000)
    Guictrlsetcolor($Label2, 0x000000)
    Guictrlsetcolor($lblCpuPer, 0x000000)
    Guictrlsetcolor($g_1, 0x000000)
    Guictrlsetcolor($g_2, 0x000000)
    Guictrlsetcolor($Spiel_1, 0x000000)
    Guictrlsetcolor($Spiel_2, 0x000000)
    Guictrlsetcolor($Spiel_3, 0x000000)
    Guictrlsetcolor($Spiel_4, 0x000000)
    Guictrlsetcolor($Spiel_5, 0x000000)
    Guictrlsetcolor($Spiel_6, 0x000000)
    Guictrlsetcolor($c, 0x000000)
    Case $msg = $Menu4_5
    Guictrlsetcolor($L_1, 0x00FF00)
    Guictrlsetcolor($L_2, 0x00FF00)
    Guictrlsetcolor($L_3, 0x00FF00)
    Guictrlsetcolor($L_4, 0x00FF00)
    Guictrlsetcolor($L_5, 0x00FF00)
    Guictrlsetcolor($L_6, 0x00FF00)
    Guictrlsetcolor($Label1, 0x00FF00)
    Guictrlsetcolor($Label2, 0x00FF00)
    Guictrlsetcolor($lblCpuPer, 0x00FF00)
    Guictrlsetcolor($g_1, 0x00FF00)
    Guictrlsetcolor($g_2, 0x00FF00)
    Guictrlsetcolor($Spiel_1, 0x00FF00)
    Guictrlsetcolor($Spiel_2, 0x00FF00)
    Guictrlsetcolor($Spiel_3, 0x00FF00)
    Guictrlsetcolor($Spiel_4, 0x00FF00)
    Guictrlsetcolor($Spiel_5, 0x00FF00)
    Guictrlsetcolor($Spiel_6, 0x00FF00)
    Guictrlsetcolor($c, 0x00FF00)
    Case $msg = $Menu4_6
    Guictrlsetcolor($L_1, 0xFF00FF)
    Guictrlsetcolor($L_2, 0xFF00FF)
    Guictrlsetcolor($L_3, 0xFF00FF)
    Guictrlsetcolor($L_4, 0xFF00FF)
    Guictrlsetcolor($L_5, 0xFF00FF)
    Guictrlsetcolor($L_6, 0xFF00FF)
    Guictrlsetcolor($Label1, 0xFF00FF)
    Guictrlsetcolor($Label2, 0xFF00FF)
    Guictrlsetcolor($lblCpuPer, 0xFF00FF)
    Guictrlsetcolor($g_1, 0xFF00FF)
    Guictrlsetcolor($g_2, 0xFF00FF)
    Guictrlsetcolor($Spiel_1, 0xFF00FF)
    Guictrlsetcolor($Spiel_2, 0xFF00FF)
    Guictrlsetcolor($Spiel_3, 0xFF00FF)
    Guictrlsetcolor($Spiel_4, 0xFF00FF)
    Guictrlsetcolor($Spiel_5, 0xFF00FF)
    Guictrlsetcolor($Spiel_6, 0xFF00FF)
    Guictrlsetcolor($c, 0xFF00FF)
    Case $msg = $Menu4_7
    Guictrlsetcolor($L_1, 0x800080)
    Guictrlsetcolor($L_2, 0x800080)
    Guictrlsetcolor($L_3, 0x800080)
    Guictrlsetcolor($L_4, 0x800080)
    Guictrlsetcolor($L_5, 0x800080)
    Guictrlsetcolor($L_6, 0x800080)
    Guictrlsetcolor($Label1, 0x800080)
    Guictrlsetcolor($Label2, 0x800080)
    Guictrlsetcolor($lblCpuPer, 0x800080)
    Guictrlsetcolor($g_1, 0x800080)
    Guictrlsetcolor($g_2, 0x800080)
    Guictrlsetcolor($Spiel_1, 0x800080)
    Guictrlsetcolor($Spiel_2, 0x800080)
    Guictrlsetcolor($Spiel_3, 0x800080)
    Guictrlsetcolor($Spiel_4, 0x800080)
    Guictrlsetcolor($Spiel_5, 0x800080)
    Guictrlsetcolor($Spiel_6, 0x800080)
    Guictrlsetcolor($c, 0x800080)
    Case $msg = $Menu4_8
    Guictrlsetcolor($L_1, 0x800000)
    Guictrlsetcolor($L_2, 0x800000)
    Guictrlsetcolor($L_3, 0x800000)
    Guictrlsetcolor($L_4, 0x800000)
    Guictrlsetcolor($L_5, 0x800000)
    Guictrlsetcolor($L_6, 0x800000)
    Guictrlsetcolor($Label1, 0x800000)
    Guictrlsetcolor($Label2, 0x800000)
    Guictrlsetcolor($lblCpuPer, 0x800000)
    Guictrlsetcolor($g_1, 0x800000)
    Guictrlsetcolor($g_2, 0x800000)
    Guictrlsetcolor($Spiel_1, 0x800000)
    Guictrlsetcolor($Spiel_2, 0x800000)
    Guictrlsetcolor($Spiel_3, 0x800000)
    Guictrlsetcolor($Spiel_4, 0x800000)
    Guictrlsetcolor($Spiel_5, 0x800000)
    Guictrlsetcolor($Spiel_6, 0x800000)
    Guictrlsetcolor($c, 0x800000)
    Case $msg = $Menu4_9
    Guictrlsetcolor($L_1, 0xFFFFFF)
    Guictrlsetcolor($L_2, 0xFFFFFF)
    Guictrlsetcolor($L_3, 0xFFFFFF)
    Guictrlsetcolor($L_4, 0xFFFFFF)
    Guictrlsetcolor($L_5, 0xFFFFFF)
    Guictrlsetcolor($L_6, 0xFFFFFF)
    Guictrlsetcolor($Label1, 0xFFFFFF)
    Guictrlsetcolor($Label2, 0xFFFFFF)
    Guictrlsetcolor($lblCpuPer, 0xFFFFFF)
    Guictrlsetcolor($g_1, 0xFFFFFF)
    Guictrlsetcolor($g_2, 0xFFFFFF)
    Guictrlsetcolor($Spiel_1, 0xFFFFFF)
    Guictrlsetcolor($Spiel_2, 0xFFFFFF)
    Guictrlsetcolor($Spiel_3, 0xFFFFFF)
    Guictrlsetcolor($Spiel_4, 0xFFFFFF)
    Guictrlsetcolor($Spiel_5, 0xFFFFFF)
    Guictrlsetcolor($Spiel_6, 0xFFFFFF)
    Guictrlsetcolor($c, 0xFFFFFF)
    Case $msg = $Menu5_1
    GUICreate("Einstellungen", 100, 100, 100, 100)
    EndSelect
    WEnd


    ;----------------------------------------------------------Uhr
    Func _time()
    If $blink Then
    GUICtrlSetData($Label1, @HOUR & ':' & @MIN & ':' & @SEC)
    $blink = Not $blink
    Else
    GUICtrlSetData($Label1, @HOUR & ':' & @MIN & ':' & @SEC)
    $blink = Not $blink
    EndIf
    EndFunc ;==>_time
    ;---------------------------------------------------------------Datum
    Func _date()
    If $blink Then
    GUICtrlSetData($Label2, @MDAY & '.' & @MON & '.' & @YEAR)
    $blink = Not $blink
    Else
    GUICtrlSetData($Label2, @MDAY & '.' & @MON & '.' & @YEAR)
    $blink = Not $blink
    EndIf
    EndFunc ;==>_time
    ;-------------------------------------------------------------------
    Func _GetCoreCount(Const $Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    $iReturn = 0
    For $ObjItem In $ObjList
    If StringInStr($ObjItem.Name, "_Total") = 0 Then $iReturn += 1
    Next
    Return $iReturn
    EndFunc ;==>_GetCoreCount
    ;---------------------------------
    Func _Random_BG()
    GUISetBkColor(Random(100, 0xFFFFFF, 1))
    EndFunc
    ;---------------------------------
    Func CpuAuslastung()
    ;Global $wbemFlagReturnImmediately = 0x10
    ;Global $wbemFlagForwardOnly = 0x20
    Global $wbemFlags = $wbemFlagReturnImmediately + $wbemFlagForwardOnly
    Global $strComputer = @ComputerName

    Global $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    Global $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlags)

    $n = 0
    $c = 0
    $sMsg = ""
    For $objItem In $colItems
    $sMsg &= "cpu%" & $objItem.LoadPercentage
    $n += 1
    Next

    $CpuAuslastung = StringSplit($sMsg, "cpu%", 1)

    For $n = "0" To $CpuAuslastung[0]
    $c += $CpuAuslastung[$n]
    Next

    Return (Round($c / $CpuAuslastung[0], 0) & "%")
    EndFunc ;==>CpuAuslastung
    ;---
    Func _ShowCpuPer()
    GUICtrlSetData($lblCpuPer,"CPU Auslastung: " & CpuAuslastung())
    EndFunc

    Einmal editiert, zuletzt von Xilent (1. September 2010 um 21:21)

  • Kürzer und Du hast blos ein GuiSetState vergesen.

    Spoiler anzeigen
    [autoit]

    #include <GuiConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <INet.au3>
    #include <Date.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    ;----------------------------------
    #Region
    ; GUI
    $title = "Red Dragon Tool"
    $font = "Times New Roman FETT"
    $font2 = "Times New Roman FETT KURSIV"
    $PublicIP = _GetIP()
    $username = @UserName
    $osversion = @OSVersion & " , " & @OSType & " , " & @OSArch & " , " & @OSBuild
    GUICreate($title, 300, 380)
    GUISetBkColor(0xff0000)
    Global $lblCpuPer
    ;-----------------------
    ; GROUP WITH RADIO BUTTONS
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) ; auf den klassischen Style umschalten
    $g_1 = GUICtrlCreateGroup("Spiele", 170, 25, 80, 150)
    GUICtrlSetFont(-1, 8.5, -1, -1, $font)
    $g_2 = GUICtrlCreateGroup("Infos", 50, 175, 200, 135)
    GUICtrlSetFont(-1, 8.5, -1, -1, $font)
    ;---------------------------------------------
    $Spiel_1 = GUICtrlCreateRadio("Cabal", 180, 40, 55)
    ;---------------------------------------------
    $spiel_2 = GUICtrlCreateRadio("CSS", 180, 60, 55)
    ;---------------------------------------------
    $spiel_3 = GUICtrlCreateRadio("C.A.", 180, 80, 55)
    ;---------------------------------------------
    $spiel_4 = GUICtrlCreateRadio("Shift", 180, 100, 55)
    ;---------------------------------------------
    $spiel_5 = GUICtrlCreateRadio("Alien S.", 180, 120, 55)
    ;---------------------------------------------
    $spiel_6 = GUICtrlCreateRadio("Pinball", 180, 140, 55)
    ;---------------------------------------------
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
    #AutoIt3Wrapper_UseX64=n
    ;-----------------------
    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20
    ;-----------------------

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

    Global $blink = True
    $Label1 = GUICtrlCreateLabel("", 55, 195, 100, 12)
    $Label2 = GUICtrlCreateLabel("", 55, 210, 100, 12)
    ;---------------------------------------Datum
    _date()

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

    GUISetState(@SW_SHOW)

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

    AdlibRegister("_date", 500)
    ;---------------------------------------Uhr
    _time()

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

    ;GUISetState(@SW_SHOW)

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

    AdlibRegister("_time", 500)
    ;-------------------------------------
    ;Label
    $L_1 = GUICtrlCreateLabel("Red Dragon", 50, 25, 120)
    GUICtrlSetFont(-1, 11, -1, -1, $font2)
    $L_2 = GUICtrlCreateLabel("Tool", 50, 40, 100, 12)
    GUICtrlSetFont(-1, 10, -1, -1, $font2)
    $L_3 = GUICtrlCreateLabel("IP: " & $PublicIP, 55, 280, 100, 12)
    $L_4 = GUICtrlCreateLabel($username, 55, 230, 100, 12)
    $L_5 = GUICtrlCreateLabel($osversion, 55, 295, 175, 12)
    $L_6 = GUICtrlCreateLabel("CPU Kerne: " & _GetCoreCount(), 55, 250, 175, 12)
    $lblCpuPer = GUICtrlCreateLabel("CPU Auslastng: " & CpuAuslastung(), 55, 265, 100, 12)
    AdlibRegister("_ShowCpuPer", 2500)

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

    ; (c)
    $c = GUICtrlCreateLabel("© Xilent", 120, 345, 100, 12)
    ;-----------------------------------------------------------------------------------------------------------------
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) ; zurück zum Standard-Windowsstyle
    #EndRegion

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

    ; BUTTON
    $button_1 = GUICtrlCreateButton("OK", 50, 315, 100)
    $button_2 = GUICtrlCreateButton("Schließen", 150, 315, 100)

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

    $button_3 = GUICtrlCreateButton("C:\ (Windows)", 50, 75, 100)
    $button_4 = GUICtrlCreateButton("D:\ (Filme)", 50, 100, 100)
    $button_5 = GUICtrlCreateButton("E:\ (Musik)", 50, 125, 100)
    $button_6 = GUICtrlCreateButton("F:\ (Daten)", 50, 150, 100)
    ;Menü
    $Menu1 = GUICtrlCreateMenu("Ausschalten")
    $Menu1_1 = GUICtrlCreateMenuItem("Herrunterfahren", $Menu1)
    $Menu1_2 = GUICtrlCreateMenuItem("Ruhezustand", $Menu1)
    $Menu1_3 = GUICtrlCreateMenuItem("Neustarten", $Menu1)
    ;---------
    $Menu2 = GUICtrlCreateMenu("Win7 Style")
    $Menu2_1 = GUICtrlCreateMenuItem("Aero", $Menu2)
    $Menu2_2 = GUICtrlCreateMenuItem("Glow Air Final", $Menu2)
    $Menu2_3 = GUICtrlCreateMenuItem("Windows 7 Black Transparent", $Menu2)
    ;---------
    $Menu3 = GUICtrlCreateMenu("H. Farbe")
    $Menu3_1 = GUICtrlCreateMenuItem("Rot", $Menu3)
    $Menu3_2 = GUICtrlCreateMenuItem("Blau", $Menu3)
    $Menu3_3 = GUICtrlCreateMenuItem("Gelb", $Menu3)
    $Menu3_4 = GUICtrlCreateMenuItem("Schwarz", $Menu3)
    $Menu3_5 = GUICtrlCreateMenuItem("Grün", $Menu3)
    $Menu3_6 = GUICtrlCreateMenuItem("Pink", $Menu3)
    $Menu3_7 = GUICtrlCreateMenuItem("Violett", $Menu3)
    $Menu3_8 = GUICtrlCreateMenuItem("Braun", $Menu3)
    $Menu3_9 = GUICtrlCreateMenuItem("Weiß", $Menu3)
    $Menu3_r = GUICtrlCreateMenuItem("Random", $Menu3)
    ;---------
    $Menu4 = GUICtrlCreateMenu("S. Farbe")
    $Menu4_1 = GUICtrlCreateMenuItem("Rot", $Menu4)
    $Menu4_2 = GUICtrlCreateMenuItem("Blau", $Menu4)
    $Menu4_3 = GUICtrlCreateMenuItem("Gelb", $Menu4)
    $Menu4_4 = GUICtrlCreateMenuItem("Schwarz", $Menu4)
    $Menu4_5 = GUICtrlCreateMenuItem("Grün", $Menu4)
    $Menu4_6 = GUICtrlCreateMenuItem("Pink", $Menu4)
    $Menu4_7 = GUICtrlCreateMenuItem("Violett", $Menu4)
    $Menu4_8 = GUICtrlCreateMenuItem("Braun", $Menu4)
    $Menu4_9 = GUICtrlCreateMenuItem("Weiß", $Menu4)
    ;---------
    $Menu5 = GUICtrlCreateMenu("E.")
    $Menu5_1 = GUICtrlCreateMenuItem("Einstellungen", $Menu5)

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

    ; GUI MESSAGE LOOP
    GUISetState()
    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $button_1
    If $Spiel_1 And GUICtrlRead($Spiel_1) = $GUI_CHECKED Then
    Run("C:\Program Files\Games-Masters.com\CABAL Online (EU)\cabal.exe")
    ElseIf $spiel_2 And GUICtrlRead($spiel_2) = $GUI_CHECKED Then
    Run("C:\Program Files\Counter-Strike Source\hl2.exe -game cstrike -nojoy -noipx -console")
    ElseIf $spiel_3 And GUICtrlRead($spiel_3) = $GUI_CHECKED Then
    Run("C:\Nexon\Combat Arms EU\CombatArms.exe")
    ElseIf $spiel_4 And GUICtrlRead($spiel_4) = $GUI_CHECKED Then
    Run("C:\Program Files\Electronic Arts\Need for Speed SHIFT\shift.exe")
    ElseIf $spiel_5 And GUICtrlRead($spiel_5) = $GUI_CHECKED Then
    Run("C:\Users\Sascha\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Steam")
    ElseIf $spiel_6 And GUICtrlRead($spiel_6) = $GUI_CHECKED Then
    Run("C:\Program Files\Microsoft Games\Pinball\PINBALL.exe")
    EndIf
    Case $msg = $button_2
    Exit
    Case $msg = $button_3
    Run(@ComSpec & " /c " & 'start C:\', "", @SW_HIDE)
    Case $msg = $button_4
    Run(@ComSpec & " /c " & 'start D:\', "", @SW_HIDE)
    Case $msg = $button_5
    Run(@ComSpec & " /c " & 'start E:\', "", @SW_HIDE)
    Case $msg = $button_6
    Run(@ComSpec & " /c " & 'start F:\', "", @SW_HIDE)
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    Case $msg = $Menu3_1
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xff0000)
    Case $msg = $Menu3_2
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x0000FF)
    Case $msg = $Menu3_3
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xFFFF00)
    Case $msg = $Menu3_4
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x000000)
    Case $msg = $Menu3_5
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x00FF00)
    Case $msg = $Menu3_6
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xFF00FF)
    Case $msg = $Menu3_7
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x800080)
    Case $msg = $Menu3_8
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0x800000)
    Case $msg = $Menu3_9
    AdlibUnRegister("_Random_BG")
    GUISetBkColor(0xFFFFFF)
    Case $msg = $Menu3_r
    AdlibRegister("_Random_BG", 1000)
    _Random_BG()
    Case $msg = $Menu2_1
    Run(@ComSpec & " /c " & 'start C:\Windows\Resources\Themes\Aero.theme', "", @SW_HIDE)
    Case $msg = $Menu2_2
    Run(@ComSpec & " /c " & 'start C:\Windows\Resources\Themes\Glow_Air_Final.theme', "", @SW_HIDE)
    Case $msg = $Menu2_3
    Run(@ComSpec & " /c " & 'start C:\Windows\Resources\Themes\W7BT.theme', "", @SW_HIDE)
    Case $msg = $Menu1_1
    Run(@ComSpec & " /c " & 'shutdown /p', "", @SW_HIDE)
    Case $msg = $Menu1_2
    Run(@ComSpec & " /c " & 'shutdown /h', "", @SW_HIDE)
    Case $msg = $Menu1_3
    Run(@ComSpec & " /c " & 'shutdown /r', "", @SW_HIDE)
    Case $msg = $Menu4_1
    SetColor(0xFF0000)
    Case $msg = $Menu4_2
    SetColor(0x0000FF)
    Case $msg = $Menu4_3
    SetColor(0xFFFF00)
    Case $msg = $Menu4_4
    SetColor(0x000000)
    Case $msg = $Menu4_5
    SetColor(0x00FF00)
    Case $msg = $Menu4_6
    SetColor(0xFF00FF)
    Case $msg = $Menu4_7
    SetColor(0x800080)
    Case $msg = $Menu4_8
    SetColor(0x800000)
    Case $msg = $Menu4_9
    SetColor(0xFFFFFF)
    Case $msg = $Menu5_1
    $hSubGui = GUICreate("Einstellungen", 100, 100, 100, 100)
    GUISetState(@SW_SHOW)
    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case -3
    GUIDelete($hSubGui)
    ExitLoop
    EndSwitch
    WEnd
    EndSelect
    WEnd

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

    Func SetColor($Color)
    GUICtrlSetColor($L_1, $Color)
    GUICtrlSetColor($L_2, $Color)
    GUICtrlSetColor($L_3, $Color)
    GUICtrlSetColor($L_4, $Color)
    GUICtrlSetColor($L_5, $Color)
    GUICtrlSetColor($L_6, $Color)
    GUICtrlSetColor($Label1, $Color)
    GUICtrlSetColor($Label2, $Color)
    GUICtrlSetColor($lblCpuPer, $Color)
    GUICtrlSetColor($g_1, $Color)
    GUICtrlSetColor($g_2, $Color)
    GUICtrlSetColor($Spiel_1, $Color)
    GUICtrlSetColor($spiel_2, $Color)
    GUICtrlSetColor($spiel_3, $Color)
    GUICtrlSetColor($spiel_4, $Color)
    GUICtrlSetColor($spiel_5, $Color)
    GUICtrlSetColor($spiel_6, $Color)
    GUICtrlSetColor($c, $Color)
    EndFunc ;==>SetColor

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

    ;----------------------------------------------------------Uhr
    Func _time()
    If $blink Then
    GUICtrlSetData($Label1, @HOUR & ':' & @MIN & ':' & @SEC)
    $blink = Not $blink
    Else
    GUICtrlSetData($Label1, @HOUR & ':' & @MIN & ':' & @SEC)
    $blink = Not $blink
    EndIf
    EndFunc ;==>_time
    ;---------------------------------------------------------------Datum
    Func _date()
    If $blink Then
    GUICtrlSetData($Label2, @MDAY & '.' & @MON & '.' & @YEAR)
    $blink = Not $blink
    Else
    GUICtrlSetData($Label2, @MDAY & '.' & @MON & '.' & @YEAR)
    $blink = Not $blink
    EndIf
    EndFunc ;==>_date
    ;-------------------------------------------------------------------
    Func _GetCoreCount(Const $Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    $iReturn = 0
    For $ObjItem In $ObjList
    If StringInStr($ObjItem.Name, "_Total") = 0 Then $iReturn += 1
    Next
    Return $iReturn
    EndFunc ;==>_GetCoreCount
    ;---------------------------------
    Func _Random_BG()
    GUISetBkColor(Random(100, 0xFFFFFF, 1))
    EndFunc ;==>_Random_BG
    ;---------------------------------
    Func CpuAuslastung()
    ;Global $wbemFlagReturnImmediately = 0x10
    ;Global $wbemFlagForwardOnly = 0x20
    Global $wbemFlags = $wbemFlagReturnImmediately + $wbemFlagForwardOnly
    Global $strComputer = @ComputerName

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

    Global $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    Global $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlags)

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

    $n = 0
    $c = 0
    $sMsg = ""
    For $ObjItem In $colItems
    $sMsg &= "cpu%" & $ObjItem.LoadPercentage
    $n += 1
    Next

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

    $CpuAuslastung = StringSplit($sMsg, "cpu%", 1)

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

    For $n = "0" To $CpuAuslastung[0]
    $c += $CpuAuslastung[$n]
    Next

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

    Return (Round($c / $CpuAuslastung[0], 0) & "%")
    EndFunc ;==>CpuAuslastung
    ;---
    Func _ShowCpuPer()
    GUICtrlSetData($lblCpuPer, "CPU Auslastung: " & CpuAuslastung())
    EndFunc ;==>_ShowCpuPer

    [/autoit]

    PS: Und nächste mal bitte Code in Einen Spoiler Packen mann scrollt sich sonst nen Wolf ;)