Bei einer _GUICtrlTreeView aktuelle Auswahl abfragen?

  • Hallo Community!

    Hab mal wieder ne' Frage...
    Wie kann ich bei einer _GUICtrlTreeView(Create) die aktuelle auswahl abfragen?

    Mit GuiCtrlRead funzt das nicht.. und bei den _GUICtrlTreeView hab ich auf den ersten Blick auch keine Funktion gefunden die mir das Ausgibt...
    Hoffe es ist nicht wieder WM_NOTIFY :wacko:


    mfg.
    Andi

    2 Mal editiert, zuletzt von sl4y3r (7. Januar 2010 um 17:00)

    • Offizieller Beitrag

    Schau dir mal _GUICtrlListView_GetSelectedIndices an.

    Edit OMG, bin ich blind. :pinch: | Es war ja ein TreeView. :thumbdown:

  • :S das geht auch nicht... Wirft mir nur eine leere MsgBox aus.

    Spoiler anzeigen
    [autoit]

    Func _GUI_Start()
    Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

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

    $_GUI_Start = GUICreate("Start", 196, 300,0,0,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
    GUISetBkColor( $BG_Color )

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

    $hTreeView = GUICtrlCreateTreeView(0, 0, 196, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUICtrlCreateButton("starten",0,268,196,20)
    GUICtrlSetBkColor(-1,$BG_Color)
    _GUICtrlSetTheme(-1)
    GUICtrlSetOnEvent(-1,"_FGUI_Start_Button_Start")

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

    _GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $_GUI_Start, "int", 0xEC)
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $_GUI_Start, "int", 0xEC, "int", BitOR($nExStyle[0], $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $_GUI_Start, "hwnd", $hGUI)
    GUISetState()

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

    $hImage = _GUIImageList_Create (16, 16, 5, 3)
    For $x = 0 To 146
    _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
    Next
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _CreateStateImageList()
    _GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)

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

    $hItem1 = _GUICtrlTreeView_Add($hTreeView, 0, "Programme", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem1, 1)
    $hChildItem1_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Browser", 13,13)
    $hChildItem1_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Explorer", 126,126)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Enigma", 47,47)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Task-Manager", 35,35)

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

    $hItem2 = _GUICtrlTreeView_Add($hTreeView, 0, "Spiele", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem2, 3)
    $hChildItem2_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem2, "Tetris", 118,118)

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

    $hItem3 = _GUICtrlTreeView_Add($hTreeView, 0, "Einstellungen", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem3, 2)
    $hChildItem3_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Allgemeine Einstellungen", 21,21)
    $hChildItem3_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Transparenz", 97,97)

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

    $hItem4 = _GUICtrlTreeView_Add($hTreeView, 0, "Info - Support", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem4, 4)
    $hChildItem4_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Version", 69,69)
    $hChildItem4_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Update", 68,68)
    $hChildItem4_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Über", 22,22)

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

    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    ; Loop until user exits

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

    EndFunc
    Func _CreateStateImageList()
    $hStateImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 12)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 80)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 23)
    EndFunc ;==>_CreateStateImageList
    Func _FGUI_Start_Button_Start()
    MsgBox(1,"",_GUICtrlListView_GetSelectedIndices($hTreeView))
    EndFunc

    [/autoit]
  • Wirft mir nur eine leere MsgBox aus.

    du weißt aber schon dass _GUICtrlListView_GetSelectedIndices ein array zurückgibt?

    http://www.autoit.de/dokumentation_…ctedIndices.htm

    [url='http://www.autoit.de/dokumentation_aktuell/keywords.htm']

    [autoit]

    Func _FGUI_Start_Button_Start()
    $temp = _GUICtrlListView_GetSelectedIndices($hTreeView))
    _arraydisplay($temp)
    EndFunc

    [/autoit]

    das sollte schon funktionieren

    Edit: ups sry für doppelpost

  • du weißt aber schon dass _GUICtrlListView_GetSelectedIndices ein array zurückgibt?

    http://www.autoit.de/dokumentation_…ctedIndices.htm

    [autoit]

    Func _FGUI_Start_Button_Start()
    $temp = _GUICtrlListView_GetSelectedIndices($hTreeView))
    _arraydisplay($temp)
    EndFunc

    [/autoit]

    das sollte schon funktionieren

    Edit: ups sry für doppelpost

    Auwehh.. :(
    mit der

    [autoit]

    _GUICtrlTreeView_GetSelection

    [/autoit]


    kommt in der MsgBox immer nur 0x000000...

    Jetzt weiß ich gar nicht weiter..

    mfg.

  • kommt in der MsgBox immer nur 0x000000...

    das passiert wenn du in _GUICtrlTreeView_GetSelection($TreeView1) die falsche variable angibst.
    hast du sicher die variable angegeben die den rückgabevert von Guictrlcreatetreeview enthält?

    wenn ja dann poste mal bitte dein gesamtes script, oder zumindest so abgekürzt dass man selber testen kann.
    also mit guicreate und allen drum und dran

  • das passiert wenn du in _GUICtrlTreeView_GetSelection($TreeView1) die falsche variable angibst.
    hast du sicher die variable angegeben die den rückgabevert von Guictrlcreatetreeview enthält?

    wenn ja dann poste mal bitte dein gesamtes script, oder zumindest so abgekürzt dass man selber testen kann.
    also mit guicreate und allen drum und dran

    Ok hab mal schnell an Stand-Alone Schnipsel draus gemacht... (Ganzes Skript hat über 800 Zeilen)

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=icon.ico
    #AutoIt3Wrapper_outfile=OUTPUT\Aut OS.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Res_Comment=Andreas Jud
    #AutoIt3Wrapper_Res_Description=Andreas Jud
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=by Andreas Jud
    #AutoIt3Wrapper_Res_Language=1031
    #AutoIt3Wrapper_Run_Obfuscator=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <ComboConstants.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include<GUIConstants.au3>
    #include<Process.au3>
    #include<Misc.au3>
    #include<String.au3>
    #include<IE.au3>
    #include<GuiStatusBar.au3>
    #include<Sound.au3>
    #include<GuiIPAddress.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiComboBoxEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GUIComboBox.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiTreeView.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>

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

    #cs
    Standalone Schnipsel
    #ce

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

    Opt("GUIOnEventMode",1)

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

    Dim $_GUI_About, $_GUI_ToolBar, $_GUI_Browser, $_GUI_Explorer, $_GUI_TaskMgr, $_GUI_Transparency, $_FakeGUI_InputBox, $_GUI_Minimize
    Dim $_visibleGUI_About, $_visibleGUI_Toolbar, $_visibleGUI_Browser, $_visibleGUI_Explorer, $_visibleGUI_TaskMgr, $_visibleGUI_Transparency
    Dim $_GUI_Toolbar_Button_Explorer, $_GUI_Toolbar_Button_Browser, $_GUI_Toolbar_Button_TaskMgr, $_GUI_Toolbar_Button_Transparency, $hTreeView
    Dim $_FGUI_Exit_Combo_Exit, $_InputBox_Input, $_FGUI_About_CheckBox_ViewOnStart
    Dim $_GUI_TaskMgr_List, $_GUI_TaskMgr_List1, $_GUI_Transparency_Slider
    Dim $URL, $B_oIE1
    Global $hImage, $hStateImage

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

    Global $File_Ini = "Data.INI"
    Global $Title = "Aut OS"
    Global $Copyright = '© Copyright 2009-2010 Andreas Jud'
    Global $Browser_Startpage

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

    Global $StandardTrans = 255
    Global $StartUpSecounds = 3
    Global $Width = 700
    Global $Height = 500
    Global $PosTop = 125
    Global $PosLeft = 0
    Global $BG_Color = 0x00FF00
    _GUI_Start()
    While 1
    Sleep(100)
    WEnd

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

    Func _GUI_Start()
    Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

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

    $_GUI_Start = GUICreate("Start", 196, 300,0,0,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
    GUISetBkColor( $BG_Color )

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

    $hTreeView = GUICtrlCreateTreeView(0, 0, 196, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUICtrlCreateButton("starten",0,268,196,20)
    GUICtrlSetBkColor(-1,$BG_Color)
    GUICtrlSetOnEvent(-1,"_FGUI_Start_Button_Start")

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

    _GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)

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

    GUISetState()

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

    $hImage = _GUIImageList_Create (16, 16, 5, 3)
    For $x = 0 To 146
    _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
    Next
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _CreateStateImageList()
    _GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)

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

    $hItem1 = _GUICtrlTreeView_Add($hTreeView, 0, "Programme", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem1, 1)
    $hChildItem1_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Browser", 13,13)

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

    $hChildItem1_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Explorer", 126,126)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Enigma", 47,47)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Task-Manager", 35,35)

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

    $hItem2 = _GUICtrlTreeView_Add($hTreeView, 0, "Spiele", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem2, 3)
    $hChildItem2_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem2, "Tetris", 118,118)

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

    $hItem3 = _GUICtrlTreeView_Add($hTreeView, 0, "Einstellungen", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem3, 2)
    $hChildItem3_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Allgemeine Einstellungen", 21,21)
    $hChildItem3_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Transparenz", 97,97)

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

    $hItem4 = _GUICtrlTreeView_Add($hTreeView, 0, "Info - Support", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem4, 4)
    $hChildItem4_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Version", 69,69)
    $hChildItem4_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Update", 68,68)
    $hChildItem4_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Über", 22,22)

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

    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    ; Loop until user exits

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

    EndFunc
    Func _CreateStateImageList()
    $hStateImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 12)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 80)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 23)
    EndFunc ;==>_CreateStateImageList
    Func _FGUI_Start_Button_Start()
    MsgBox(1,"",_GUICtrlTreeView_GetSelection($hTreeView))
    EndFunc
    Func _Msgbox()
    MsgBox(1,"","TEST BOX")
    EndFunc

    [/autoit]
  • Hallo sl4y3r,

    hier mal ein Beispiel zu _GUICtrlTreeView_GetSelection (auf Button klicken):

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #include <GuiConstantsEx.au3>
    #include <GuiTreeView.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>

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

    Opt('MustDeclareVars', 1)

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

    $Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

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

    Global $hImage, $hStateImage

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

    _Main()
    exit

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

    Func _Main()

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

    Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView, $hbtnInfo, $iItemIndex, $msg
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

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

    GUICreate("TreeView Get Text", 400, 350)

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

    $hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    $hbtnInfo = GUICtrlCreateButton("&Aktuelles Item?",2,320,100,25)
    ;_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
    GUISetState()

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

    _CreateNormalImageList()
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _CreateStateImageList()
    _GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    For $x = 0 To 9
    $hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
    ;_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
    For $y = 1 To 3
    $hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child from {%02d]", $y, $x), 0, 3)
    ;_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
    $iYItem += 1
    Next
    Next
    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    _GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
    ;_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

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

    $iRand = Random(0, 9, 1)
    MsgBox(4160, "Information", StringFormat("Text for Item %d: %s", $iRand, _GUICtrlTreeView_GetText($hTreeView, $hItem[$iRand])))

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

    ; Loop until user exits
    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    GUIDelete()
    Exit
    Case $hbtnInfo
    $iItemIndex = _GUICtrlTreeView_GetSelection($hTreeView)
    MsgBox(0, "Information", _GUICtrlTreeView_GetText($hTreeView, $iItemIndex))
    EndSwitch
    WEnd
    EndFunc ;==>_Main

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

    Func _CreateNormalImageList()
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 165)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 168)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 146)
    EndFunc ;==>_CreateNormalImageList

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

    Func _CreateStateImageList()
    $hStateImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
    EndFunc ;==>_CreateStateImageList

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

    ,

    dein abgeändertes Skript, die Variable $hTreeView war Global und lokal definiert:

    [autoit]

    #NoTrayIcon
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=icon.ico
    #AutoIt3Wrapper_outfile=OUTPUT\Aut OS.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Res_Comment=Andreas Jud
    #AutoIt3Wrapper_Res_Description=Andreas Jud
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=by Andreas Jud
    #AutoIt3Wrapper_Res_Language=1031
    #AutoIt3Wrapper_Run_Obfuscator=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <ComboConstants.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include<GUIConstants.au3>
    #include<Process.au3>
    #include<Misc.au3>
    #include<String.au3>
    #include<IE.au3>
    #include<GuiStatusBar.au3>
    #include<Sound.au3>
    #include<GuiIPAddress.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiComboBoxEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GUIComboBox.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiTreeView.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>

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

    #cs
    Standalone Schnipsel
    #ce

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

    Opt("GUIOnEventMode",1)

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

    Dim $_GUI_About, $_GUI_ToolBar, $_GUI_Browser, $_GUI_Explorer, $_GUI_TaskMgr, $_GUI_Transparency, $_FakeGUI_InputBox, $_GUI_Minimize
    Dim $_visibleGUI_About, $_visibleGUI_Toolbar, $_visibleGUI_Browser, $_visibleGUI_Explorer, $_visibleGUI_TaskMgr, $_visibleGUI_Transparency
    Dim $_GUI_Toolbar_Button_Explorer, $_GUI_Toolbar_Button_Browser, $_GUI_Toolbar_Button_TaskMgr, $_GUI_Toolbar_Button_Transparency, $hTreeView
    Dim $_FGUI_Exit_Combo_Exit, $_InputBox_Input, $_FGUI_About_CheckBox_ViewOnStart
    Dim $_GUI_TaskMgr_List, $_GUI_TaskMgr_List1, $_GUI_Transparency_Slider
    Dim $URL, $B_oIE1
    Global $hImage, $hStateImage

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

    Global $File_Ini = "Data.INI"
    Global $Title = "Aut OS"
    Global $Copyright = '© Copyright 2009-2010 Andreas Jud'
    Global $Browser_Startpage

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

    Global $StandardTrans = 255
    Global $StartUpSecounds = 3
    Global $Width = 700
    Global $Height = 500
    Global $PosTop = 125
    Global $PosLeft = 0
    Global $BG_Color = 0x00FF00
    _GUI_Start()
    While 1
    Sleep(100)
    WEnd

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

    Func _GUI_Start()
    Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

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

    $_GUI_Start = GUICreate("Start", 196, 300,0,0,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
    GUISetBkColor( $BG_Color )

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

    $hTreeView = GUICtrlCreateTreeView(0, 0, 196, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUICtrlCreateButton("starten",0,268,196,20)
    GUICtrlSetBkColor(-1,$BG_Color)
    GUICtrlSetOnEvent(-1,"_FGUI_Start_Button_Start")

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

    ;_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)

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

    GUISetState()

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

    $hImage = _GUIImageList_Create (16, 16, 5, 3)
    For $x = 0 To 146
    _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
    Next
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _CreateStateImageList()
    _GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)

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

    $hItem1 = _GUICtrlTreeView_Add($hTreeView, 0, "Programme", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem1, 1)
    $hChildItem1_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Browser", 13,13)

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

    $hChildItem1_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Explorer", 126,126)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Enigma", 47,47)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Task-Manager", 35,35)

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

    $hItem2 = _GUICtrlTreeView_Add($hTreeView, 0, "Spiele", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem2, 3)
    $hChildItem2_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem2, "Tetris", 118,118)

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

    $hItem3 = _GUICtrlTreeView_Add($hTreeView, 0, "Einstellungen", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem3, 2)
    $hChildItem3_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Allgemeine Einstellungen", 21,21)
    $hChildItem3_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Transparenz", 97,97)

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

    $hItem4 = _GUICtrlTreeView_Add($hTreeView, 0, "Info - Support", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem4, 4)
    $hChildItem4_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Version", 69,69)
    $hChildItem4_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Update", 68,68)
    $hChildItem4_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Über", 22,22)

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

    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    ; Loop until user exits

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

    EndFunc
    Func _CreateStateImageList()
    $hStateImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 12)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 80)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 23)
    EndFunc ;==>_CreateStateImageList
    Func _FGUI_Start_Button_Start()
    $iItemIndex = _GUICtrlTreeView_GetSelection($hTreeView)
    MsgBox(0, "Information", _GUICtrlTreeView_GetText($hTreeView, $iItemIndex))
    EndFunc

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

    Func _Msgbox()
    MsgBox(1,"","TEST BOX")
    EndFunc

    [/autoit]


    mfg (Auto)Bert

    Einmal editiert, zuletzt von AutoBert (7. Januar 2010 um 17:02)

  • :rofl: scheisse bin ich doof...
    hab vorher $hTreeView nur bei den Lokalen Variablen gehabt...
    tjaja, jetzt gehts..

    Danke nochmal an alle die mitgeholfen haben!

    Wer es sich angucken will:

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=icon.ico
    #AutoIt3Wrapper_outfile=OUTPUT\Aut OS.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Res_Comment=Andreas Jud
    #AutoIt3Wrapper_Res_Description=Andreas Jud
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=by Andreas Jud
    #AutoIt3Wrapper_Res_Language=1031
    #AutoIt3Wrapper_Run_Obfuscator=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <ComboConstants.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include<GUIConstants.au3>
    #include<Process.au3>
    #include<Misc.au3>
    #include<String.au3>
    #include<IE.au3>
    #include<GuiStatusBar.au3>
    #include<Sound.au3>
    #include<GuiIPAddress.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiComboBoxEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GUIComboBox.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiTreeView.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>

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

    #cs
    Standalone Schnipsel
    #ce

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

    Opt("GUIOnEventMode",1)

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

    Dim $_GUI_About, $_GUI_ToolBar, $_GUI_Browser, $_GUI_Explorer, $_GUI_TaskMgr, $_GUI_Transparency, $_FakeGUI_InputBox, $_GUI_Minimize
    Dim $_visibleGUI_About, $_visibleGUI_Toolbar, $_visibleGUI_Browser, $_visibleGUI_Explorer, $_visibleGUI_TaskMgr, $_visibleGUI_Transparency
    Dim $_GUI_Toolbar_Button_Explorer, $_GUI_Toolbar_Button_Browser, $_GUI_Toolbar_Button_TaskMgr, $_GUI_Toolbar_Button_Transparency, $hTreeView
    Dim $_FGUI_Exit_Combo_Exit, $_InputBox_Input, $_FGUI_About_CheckBox_ViewOnStart
    Dim $_GUI_TaskMgr_List, $_GUI_TaskMgr_List1, $_GUI_Transparency_Slider
    Dim $URL, $B_oIE1
    Global $hImage, $hStateImage

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

    Global $File_Ini = "Data.INI"
    Global $Title = "Aut OS"
    Global $Copyright = '© Copyright 2009-2010 Andreas Jud'
    Global $Browser_Startpage

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

    Global $StandardTrans = 255
    Global $StartUpSecounds = 3
    Global $Width = 700
    Global $Height = 500
    Global $PosTop = 125
    Global $PosLeft = 0
    Global $BG_Color = 0x00FF00
    _GUI_Start()
    While 1
    Sleep(100)
    WEnd

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

    Func _GUI_Start()
    Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

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

    $_GUI_Start = GUICreate("Start", 196, 300,0,0,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
    GUISetBkColor( $BG_Color )

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

    $hTreeView = GUICtrlCreateTreeView(0, 0, 196, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUICtrlCreateButton("starten",0,268,196,20)
    GUICtrlSetBkColor(-1,$BG_Color)
    GUICtrlSetOnEvent(-1,"_FGUI_Start_Button_Start")

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

    _GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)

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

    GUISetState()

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

    $hImage = _GUIImageList_Create (16, 16, 5, 3)
    For $x = 0 To 146
    _GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
    Next
    _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

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

    _CreateStateImageList()
    _GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeView)

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

    $hItem1 = _GUICtrlTreeView_Add($hTreeView, 0, "Programme", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem1, 1)
    $hChildItem1_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Browser", 13,13)

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

    $hChildItem1_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Explorer", 126,126)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Enigma", 47,47)
    $hChildItem1_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem1, "Task-Manager", 35,35)

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

    $hItem2 = _GUICtrlTreeView_Add($hTreeView, 0, "Spiele", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem2, 3)
    $hChildItem2_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem2, "Tetris", 118,118)

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

    $hItem3 = _GUICtrlTreeView_Add($hTreeView, 0, "Einstellungen", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem3, 2)
    $hChildItem3_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Allgemeine Einstellungen", 21,21)
    $hChildItem3_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem3, "Transparenz", 97,97)

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

    $hItem4 = _GUICtrlTreeView_Add($hTreeView, 0, "Info - Support", 137, 146)
    _GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem4, 4)
    $hChildItem4_1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Version", 69,69)
    $hChildItem4_2 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Update", 68,68)
    $hChildItem4_3 = _GUICtrlTreeView_AddChild($hTreeView, $hItem4, "Über", 22,22)

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

    _GUICtrlTreeView_EndUpdate($hTreeView)

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

    ; Loop until user exits

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

    EndFunc
    Func _CreateStateImageList()
    $hStateImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 12)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 80)
    _GUIImageList_AddIcon($hStateImage, "shell32.dll", 23)
    EndFunc ;==>_CreateStateImageList
    Func _FGUI_Start_Button_Start()
    $iItemIndex = _GUICtrlTreeView_GetSelection($hTreeView)
    MsgBox(0, "Information", _GUICtrlTreeView_GetText($hTreeView, $iItemIndex))
    EndFunc
    Func _Msgbox()
    MsgBox(1,"","TEST BOX")
    EndFunc

    [/autoit]