1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Oscar

Beiträge von Oscar

  • SSD - Hilfe bei Kaufentscheidung

    • Oscar
    • 6. Februar 2011 um 20:31

    Ich überlege gerade mir eine SSD zuzulegen. Ich verspreche mir davon, vor allem, ein schnelleres booten von Windows und ein beschleunigtes starten der Anwendungen.
    Erfahrung habe ich mit SSDs bisher keine. Meine bisherige System-Festplatte ist auch noch eine mit 5400 U/min (also nicht gerade die schnellste).
    Deshalb frage ich euch: Worauf sollte ich beim Kauf achten? Was könnt ihr mir empfehlen?

    Bedingungen:
    - Kapazität so um die 100 GB
    - Preis max. 200 €
    - Installiert werden soll Windows 7 (64 Bit)

    Ich habe bei Alternate eine SSD gefunden, die ziemlich viele gute Bewertungen bekommen hat: http://www.alternate.de/html/product/Festplatte/OCZ/Vertex2_E_2,5_SSD_120_GB/251228/?tn=HARDWARE&l1=Solid+State+Drives&l2=SATA&l3=2%2C5+Zoll
    Was haltet ihr davon?

  • Drag and Drop innerhalb eines Listview

    • Oscar
    • 6. Februar 2011 um 20:02

    Ah, auch nicht schlecht. :thumbup:
    Kommt auch in Post#1.

  • Combobox vertieft

    • Oscar
    • 6. Februar 2011 um 18:34

    Nein, in der Hilfe ist das IMO nicht erwähnt. Die DllCalls habe ich mal irgendwann archiviert, als sie hier im Forum auftauchten. :D

  • Combobox vertieft

    • Oscar
    • 6. Februar 2011 um 16:40

    Diese vertiefte Darstellung, wie in dem Bild von Sprenger120, gibt es nur im klassischen Style. Dafür musst Du entsprechend umschalten:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 447, 193, 125)

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

    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) ; auf den klassischen Style umschalten
    $Combo1 = GUICtrlCreateCombo("Klassisch", 72, 56, 161, 25)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) ; zurück zum Standard-Windowsstyle

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

    $Combo2 = GUICtrlCreateCombo("Normal", 272, 56, 161, 25)

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

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • DragListBox

    • Oscar
    • 6. Februar 2011 um 13:44

    Klasse gemacht! :thumbup:
    Die Markierung an der Seite gefällt mir.
    Allerdings funktioniert das Skript nicht im 64Bit-Modus. Da muss also ein:

    [autoit]

    #AutoIt3Wrapper_UseX64=n

    [/autoit]


    an den Anfang, sonst klappt das nicht mit dem Drag&Drop.

  • Drag and Drop innerhalb eines Listview

    • Oscar
    • 6. Februar 2011 um 13:36

    Jo! Gefällt mir! :thumbup:
    Habe die gestraffte Version mal mit in Post#1 aufgenommen, damit man sie leichter findet.

  • Drag and Drop innerhalb eines Listview

    • Oscar
    • 5. Februar 2011 um 19:37
    Zitat von BadBunny

    wofür ist #forceref $hWnd, $iMsg, $iwParam?


    Das ist lediglich eine Präprozessor-Anweisung, diese Variablen zu ignorieren, wenn MustDeclareVars benutzt wird. Ansonsten würde es eine Warnmeldung geben.

  • Drag and Drop innerhalb eines Listview

    • Oscar
    • 5. Februar 2011 um 19:27

    Irgendwie waren mir meine bisherigen Versuche zu dem Thema nicht "schön" genug. Jetzt habe ich mal ein Beispiel erstellt, dass mir schon viel besser gefällt. :D
    Und weil die Frage gerade auch wieder in H&U aufgetaucht ist, wollte ich euch das nicht vorenthalten:

    Spoiler anzeigen
    [autoit]


    ; *********************************************************
    ; Das untenstehende Beispiel funktioniert nur im 32Bit-Mode
    ; *********************************************************
    #AutoIt3Wrapper_UseX64=n
    ; *********************************************************

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

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <StructureConstants.au3>
    #include <WindowsConstants.au3>

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

    Opt('GUIOnEventMode', 1)

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

    Global $iStartIndex, $iEndIndex, $fLVDrag = False

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

    $hGui = GUICreate('ListView Drag&Drop', 240, 280)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_End')

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

    $hListView = GUICtrlCreateListView('AAA|BBB|CCC', 10, 10, 220, 260)
    $hWndListView = GUICtrlGetHandle($hListView)

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

    For $i = 0 To 9
    GUICtrlCreateListViewItem(StringFormat('%s|%s|%s', Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)), Chr(Random(65, 90, 1)), Random(0, 9, 1)), $hListView)
    Next

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

    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')

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

    WinWaitClose($hGui)

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

    Func _End()
    Exit
    EndFunc ;==>_End

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $tNMHDR, $hWndFrom, $iCode, $tNMLISTVIEW
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
    $iCode = DllStructGetData($tNMHDR, 'Code')
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $LVN_BEGINDRAG
    If Not $fLVDrag Then
    $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $ilParam)
    $iStartIndex = DllStructGetData($tNMLISTVIEW, 'Item')
    $fLVDrag = True
    GUIRegisterMsg($WM_MOUSEMOVE, 'WM_MOUSEMOVE')
    EndIf
    Case $LVN_HOTTRACK
    If $fLVDrag Then
    $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $ilParam)
    $iEndIndex = DllStructGetData($tNMLISTVIEW, 'Item')
    $fLVDrag = False
    GUIRegisterMsg($WM_MOUSEMOVE, '')
    _GUICtrlListView_ChangeItemIndex($hListView, $iStartIndex, $iEndIndex)
    _GUICtrlListView_SetItemSelected($hListView, $iEndIndex, True, True)
    EndIf
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    Func WM_MOUSEMOVE($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam, $ilParam
    Local $aHit = _GUICtrlListView_HitTest($hWndListView)
    If IsArray($aHit) Then _GUICtrlListView_SetItemFocused($hListView, $aHit[0])
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_MOUSEMOVE

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

    Func _GUICtrlListView_ChangeItemIndex($hListView, $iStart, $iEnd)
    Local $sTmp, $iCount = _GUICtrlListView_GetItemCount($hListView)
    If $iCount = 0 Then Return
    If $iStart = $iEnd Then Return
    If $iStart < 0 Then $iStart = 0
    If $iEnd = -1 Or $iEnd >= $iCount Then $iEnd = $iCount - 1
    If $iStart < $iEnd Then
    $sTmp = _GUICtrlListView_GetItemTextString($hListView, $iStart)
    For $i = $iStart To $iEnd - 1
    _GUICtrlListView_SetItemText($hListView, $i, _GUICtrlListView_GetItemTextString($hListView, $i + 1), -1)
    Next
    _GUICtrlListView_SetItemText($hListView, $iEnd, $sTmp, -1)
    Else
    $sTmp = _GUICtrlListView_GetItemTextString($hListView, $iStart)
    For $i = $iStart To $iEnd + 1 Step -1
    _GUICtrlListView_SetItemText($hListView, $i, _GUICtrlListView_GetItemTextString($hListView, $i - 1), -1)
    Next
    _GUICtrlListView_SetItemText($hListView, $iEnd, $sTmp, -1)
    EndIf
    EndFunc ;==>_GUICtrlListView_ChangeItemIndex

    [/autoit]

    Von "Großvater" gestraffte Version:

    Spoiler anzeigen
    [autoit]


    ; *********************************************************
    ; Das untenstehende Beispiel funktioniert nur im 32Bit-Mode
    ; *********************************************************
    #AutoIt3Wrapper_UseX64=n
    ; *********************************************************

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

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <WindowsConstants.au3>

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

    Opt('GUIOnEventMode', 1)

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

    $hGui = GUICreate('ListView Drag&Drop', 240, 280)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_End')

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

    $hListView = GUICtrlCreateListView('AAA|BBB|CCC', 10, 10, 220, 260)
    $hWndListView = GUICtrlGetHandle($hListView)

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

    For $i = 0 To 9
    GUICtrlCreateListViewItem(StringFormat('%s|%s|%s', Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)), Chr(Random(65, 90, 1)), Random(0, 9, 1)), $hListView)
    Next

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

    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, '_DragListView')

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

    WinWaitClose($hGui)

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

    Func _End()
    Exit
    EndFunc ;==>_End

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

    Func _DragListView($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iwParam
    Local Static $iStartIndex = -1, $iEndIndex = -1, $sItemText = "", $fLVDrag = False
    Switch $iMsg
    Case $WM_MOUSEMOVE
    Local $aHit = _GUICtrlListView_HitTest($hWndListView)
    If IsArray($aHit) Then _GUICtrlListView_SetItemFocused($hWndListView, $aHit[0])
    Case $WM_NOTIFY
    Local $tNMHDR, $hWndFrom, $iCode, $iNewItem, $tNMLISTVIEW
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
    $iCode = DllStructGetData($tNMHDR, 'Code')
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $LVN_BEGINDRAG
    If Not $fLVDrag Then
    $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $ilParam)
    $iStartIndex = DllStructGetData($tNMLISTVIEW, 'Item')
    $sItemText = _GUICtrlListView_GetItemTextString($hWndListView, $iStartIndex)
    $fLVDrag = True
    GUIRegisterMsg($WM_MOUSEMOVE, '_DragListView')
    EndIf
    Case $LVN_HOTTRACK
    If $fLVDrag Then
    $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $ilParam)
    $iEndIndex = DllStructGetData($tNMLISTVIEW, 'Item')
    $fLVDrag = False
    GUIRegisterMsg($WM_MOUSEMOVE, '')
    Select
    Case $iStartIndex < $iEndIndex
    $iNewItem = _GUICtrlListView_InsertItem($hWndListView, "", $iEndIndex + 1)
    _GUICtrlListView_SetItemText($hWndListView, $iNewItem, $sItemText, -1)
    _GUICtrlListView_SetItemSelected($hWndListView, $iNewItem, True, True)
    _GUICtrlListView_DeleteItem($hWndListView, $iStartIndex)
    Case $iStartIndex > $iEndIndex
    _GUICtrlListView_DeleteItem($hWndListView, $iStartIndex)
    $iNewItem = _GUICtrlListView_InsertItem($hWndListView, "", $iEndIndex)
    _GUICtrlListView_SetItemText($hWndListView, $iNewItem, $sItemText, -1)
    _GUICtrlListView_SetItemSelected($hWndListView, $iNewItem, True, True)
    EndSelect
    EndIf
    EndSwitch
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_DragListView

    [/autoit]

    Von "BugFix" angepasste Version mit Drag&Drop auch innerhalb einer Zeile:

    Spoiler anzeigen
    [autoit]


    ; *********************************************************
    ; Das untenstehende Beispiel funktioniert nur im 32Bit-Mode
    ; *********************************************************
    #AutoIt3Wrapper_UseX64=n
    ; *********************************************************

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

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <WindowsConstants.au3>

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

    Opt('GUIOnEventMode', 1)

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

    $hGui = GUICreate('ListView Drag&Drop', 240, 280)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_End')

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

    $hListView = GUICtrlCreateListView('AAA|BBB|CCC', 10, 10, 220, 260)
    $hWndListView = GUICtrlGetHandle($hListView)

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

    For $i = 0 To 9
    GUICtrlCreateListViewItem(StringFormat('%s|%s|%s', Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)), Chr(Random(65, 90, 1)), Random(0, 9, 1)), $hListView)
    Next

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

    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, '_DragListView')

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

    WinWaitClose($hGui)

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

    Func _End()
    Exit
    EndFunc ;==>_End

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

    Func _DragListView($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iwParam
    Local Static $iStartIndex = -1, $iEndIndex = -1, $sItemText = "", $fLVDrag = False
    Local Static $txtStartSubItem, $txtEndSubItem, $iStartSubIndex, $iEndSubIndex
    Switch $iMsg
    Case $WM_MOUSEMOVE
    Local $aHit = _GUICtrlListView_HitTest($hWndListView)
    If IsArray($aHit) Then _GUICtrlListView_SetItemFocused($hWndListView, $aHit[0])
    Case $WM_NOTIFY
    Local $tNMHDR, $hWndFrom, $iCode, $iNewItem, $tNMLISTVIEW
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
    $iCode = DllStructGetData($tNMHDR, 'Code')
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $LVN_BEGINDRAG
    If Not $fLVDrag Then
    $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $ilParam)
    $iStartIndex = DllStructGetData($tNMLISTVIEW, 'Item')
    $iStartSubIndex = DllStructGetData($tNMLISTVIEW, 'SubItem')
    $txtStartSubItem = _GUICtrlListView_GetItemText($hWndListView, $iStartIndex, $iStartSubIndex)
    $sItemText = _GUICtrlListView_GetItemTextString($hWndListView, $iStartIndex)
    $fLVDrag = True
    GUIRegisterMsg($WM_MOUSEMOVE, '_DragListView')
    EndIf
    Case $LVN_HOTTRACK
    If $fLVDrag Then
    $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $ilParam)
    $iEndIndex = DllStructGetData($tNMLISTVIEW, 'Item')
    $iEndSubIndex = DllStructGetData($tNMLISTVIEW, 'SubItem')
    $txtEndSubItem = _GUICtrlListView_GetItemText($hWndListView, $iEndIndex, $iEndSubIndex)
    $fLVDrag = False
    GUIRegisterMsg($WM_MOUSEMOVE, '')
    Select
    Case $iStartIndex < $iEndIndex
    $iNewItem = _GUICtrlListView_InsertItem($hWndListView, "", $iEndIndex + 1)
    _GUICtrlListView_SetItemText($hWndListView, $iNewItem, $sItemText, -1)
    _GUICtrlListView_SetItemSelected($hWndListView, $iNewItem, True, True)
    _GUICtrlListView_DeleteItem($hWndListView, $iStartIndex)
    Case $iStartIndex > $iEndIndex
    _GUICtrlListView_DeleteItem($hWndListView, $iStartIndex)
    $iNewItem = _GUICtrlListView_InsertItem($hWndListView, "", $iEndIndex)
    _GUICtrlListView_SetItemText($hWndListView, $iNewItem, $sItemText, -1)
    _GUICtrlListView_SetItemSelected($hWndListView, $iNewItem, True, True)
    Case ($iStartIndex = $iEndIndex) And ($iStartSubIndex <> $iEndSubIndex)
    _GUICtrlListView_SetItemText($hWndListView, $iEndIndex, $txtEndSubItem, $iStartSubIndex)
    _GUICtrlListView_SetItemText($hWndListView, $iEndIndex, $txtStartSubItem, $iEndSubIndex)
    EndSelect
    EndIf
    EndSwitch
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_DragListView

    [/autoit]
  • Gui bei der Taskbar rechts

    • Oscar
    • 5. Februar 2011 um 19:21

    So (aus dem Archiv):

    [autoit]


    Opt('WinTitleMatchMode', 4)
    $aTaskbarPos = WinGetPos('classname=Shell_TrayWnd')
    $iWidth = 400
    $iHeight = 300
    $iLeft = $aTaskbarPos[2] - $iWidth - 12
    $iTop = $aTaskbarPos[1] - $iHeight - 32

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

    GUICreate('test', $iWidth, $iHeight, $iLeft, $iTop)
    GUISetState()
    Do
    Until GUIGetMsg() = -3

    [/autoit]
  • Input-Feld & Text Konvertieren

    • Oscar
    • 4. Februar 2011 um 19:23

    Geht auch mit WM_COMMAND. Du musst nur den Focus wieder auf das Input-Control setzen:

    Spoiler anzeigen
    [autoit]


    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    GUICreate("", 200, 100)
    $button = GUICtrlCreateButton("Rechnen", 10, 10)
    $input = GUICtrlCreateInput("12+3", 10, 50, 100, 20)
    GUISetState()
    GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $button
    _rechnen()
    EndSwitch
    WEnd

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

    Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode, $nID
    $nNotifyCode = BitShift($wParam, 16)
    $nID = BitAND($wParam, 0x0000FFFF)
    Switch $nID
    Case $input
    Switch $nNotifyCode
    Case $EN_SETFOCUS
    GUICtrlSendMsg($input, $EM_SETSEL, 0, -1)
    GUICtrlSetState($input, $GUI_FOCUS)
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

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

    Func _rechnen()
    $read = Execute(GUICtrlRead($input))
    MsgBox(0, "", $read)
    EndFunc ;==>_rechnen

    [/autoit]
  • Input-Feld & Text Konvertieren

    • Oscar
    • 4. Februar 2011 um 18:33

    Dafür gibt es Execute:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    GUICreate("", 100, 100)
    $button = GUICtrlCreateButton("Rechnen", 10, 10)
    $input = GUICtrlCreateInput("12+3", 10, 50)
    GUISetState()
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $button
    _rechnen()
    EndSwitch
    WEnd
    Func _rechnen()
    $read = Execute(GUICtrlRead($input))
    ;~ $output = Number($read)
    MsgBox(0, "", $read)
    EndFunc ;==>_rechnen

    [/autoit]
  • Happy Birthday, Andy

    • Oscar
    • 4. Februar 2011 um 04:50

    Moin Andy!
    Alles Gute zu Deinem Geburtstag!
    Bleib uns erhalten und bereichere weiterhin das Forum durch Deine zahlreichen Skripte und hilfreichen Tipps. :thumbup:


    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Dateien

    geburtstag7.jpg 75,56 kB – 0 Downloads
  • XP Rechner per Mailboxabfrage den Shutdown Befehl zugeben

    • Oscar
    • 3. Februar 2011 um 16:55

    Mit Hilfe der _POP3-UDF (V1.02) ist das möglich.

    [verschoben nach H&U]

  • Datei in einem "Unbekannten Ordner" löschen

    • Oscar
    • 3. Februar 2011 um 15:50

    [closed]

  • FileListToArray im gesamten Verzeichnisbaum aber nicht rekursiv

    • Oscar
    • 3. Februar 2011 um 09:44

    Ah! Ein "or" statt dem "and". Na, klar! Jetzt stimmen auch die Ausgaben überein.

    Aber bei einem @error die Funktion verlassen ist verkehrt, denn ein error tritt bei dem DllCall bereits auf, wenn der Zugriff auf ein Verzeichnis fehlschlägt (fehlende Rechte).

  • Treeview Hilfe

    • Oscar
    • 2. Februar 2011 um 21:56

    Ich habe die Funktion mal mit ein paar Kommentaren versehen.
    Und eine Möglichkeit zum auswählen per Mausklick eingebaut (ich hoffe, dass Du das so meinst):

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiTreeView.au3>
    #include <ListViewConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>

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

    $data = "SIC2|E:\AU3\SIC2|0|True||OK|Everyone|Full Access" & @LF & _
    "AU3$|E:\AU3|0|10|Coding Share|OK|Everyone|Full Access" & @LF & _
    "Output|E:\AU3\SIC2\Output|0|True||OK|Everyone|Full Access" & @LF & _
    "SDOC|E:\SDOC|0|True|Test Share|OK|Administrators|Full Access" & @LF & _
    "SDOC|E:\SDOC|0|True|Test Share|OK|Everyone|Change Access" & @LF & _
    "HPBin|E:\Hewlett-Packard\ESS Sizers\Profile Manager\Bin|0|True||OK|Everyone|Read Access" & @LF & _
    "wmpub|C:\wmpub|0|True||OK|Administrators|Full Access" & @LF & _
    "wmpub|C:\wmpub|0|True||OK|Everyone|Read Access" & @LF & _
    "wmpub|C:\wmpub|0|True||OK|Users|Change Access" & @LF & _
    "wmiislog|C:\wmpub\wmiislog|0|True||OK|Everyone|Full Access" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Guest|Full Access Denied" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Administrators|Full Access" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Everyone|Read Access" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Power Users|Change Access"

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

    $aData = Create2DArray($data)

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

    $hGUI = GUICreate("Test", 800, 600)
    $hTreeview = GUICtrlCreateTreeView(8, 144, 257, 362, BitOR($GUI_SS_DEFAULT_TREEVIEW, $TVS_EDITLABELS, $TVS_CHECKBOXES, $WS_BORDER))
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $hWndTreeview = GUICtrlGetHandle($hTreeview)
    $hDummyTreeview = GUICtrlCreateDummy()
    $hListview = GUICtrlCreateListView("Share|Path|Type|Max. Allowed|Description|Status|Account|Permission", 272, 144, 522, 362, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_AUTOARRANGE), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES))
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUISetState(@SW_SHOW)
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 85)
    _GUICtrlTreeView_SetNormalImageList($hTreeview, $hImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeview)
    $root = _GUICtrlTreeView_Add($hTreeview, 1, "Shares on TEST_System", 0, 0)
    For $i = 0 To UBound($aData) - 1
    $hItem = _GUICtrlTreeView_FindParent($hTreeview, $aData[$i][1], $root)
    If $hItem Then
    _GUICtrlTreeView_AddChild($hTreeview, $hItem, $aData[$i][1])
    Else
    _GUICtrlTreeView_AddChild($hTreeview, $root, $aData[$i][1])
    EndIf
    Next
    _GUICtrlTreeView_EndUpdate($hTreeview)
    _GUICtrlTreeView_Expand($hTreeview)
    GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUIDelete($hGUI)
    Exit
    Case $hDummyTreeview
    $hSelItem = _GUICtrlTreeView_GetSelection($hWndTreeview)
    $sSelText = _GUICtrlTreeView_GetText($hTreeview, $hSelItem)
    If $sSelText = _GUICtrlTreeView_GetText($hTreeview, $root) Then
    _GUICtrlListView_AddArray($hListview, $aData)
    Else
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListview))
    For $i = 0 To UBound($aData) - 1
    If $aData[$i][1] = $sSelText Then
    $sTmp = ''
    For $j = 0 To 7
    $sTmp &= $aData[$i][$j] & '|'
    Next
    GUICtrlCreateListViewItem(StringTrimRight($sTmp, 1), $hListview)
    EndIf
    Next
    EndIf
    EndSwitch
    WEnd

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $aMousePos, $hItem, $tNMTREEVIEW = DllStructCreate($tagNMTREEVIEW, $ilParam)
    If DllStructGetData($tNMTREEVIEW, 'hWndFrom') = $hWndTreeview Then
    Switch DllStructGetData($tNMTREEVIEW, 'Code')
    Case $NM_CLICK
    GUICtrlSendToDummy($hDummyTreeview)
    EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    Func _GUICtrlTreeView_FindParent($hTreeview, $sSearch, $hRoot)
    Local $sText, $hItem, $hNextSibling = _GUICtrlTreeView_GetFirstChild($hTreeview, $hRoot) ; Handle vom ersten Child
    If $hNextSibling = 0 Then Return $hItem ; wenn kein Child vorhanden, dann verlassen
    Do
    $sText = _GUICtrlTreeView_GetText($hTreeview, $hNextSibling) ; Text vom TreeView-Item auslesen
    If StringInStr($sSearch, $sText) Then ; wenn der Text im Suchwort enthalten ist, dann...
    If _GUICtrlTreeView_GetChildCount($hTreeview, $hNextSibling) > 0 Then $hItem = _GUICtrlTreeView_FindParent($hTreeview, $sSearch, $hNextSibling) ; falls das Item noch Childs besitzt, die Funktion rekursiv aufrufen
    If $hItem > 0 Then Return $hItem ; wenn der rekursive Aufruf, bereits einen Treffer brachte, dann die Funktion verlassen
    $hItem = $hNextSibling ; der Text war im Suchwort vorhanden, also ist $hItem schonmal ein Treffer
    EndIf
    If $sSearch = $sText Then $hItem = -1 ; wenn das Suchwort gleich dem Text ist, dann gibt es den Eintrag bereits
    $hNextSibling = _GUICtrlTreeView_GetNextSibling($hTreeview, $hNextSibling) ; nächsten Sibling für die Suche benutzen
    Until $hNextSibling = 0 ; Schleife wiederholen, solange noch ein Sibling vorhanden
    Return $hItem
    EndFunc ;==>_GUICtrlTreeView_FindParent

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

    Func Create2DArray($string, $delimiter = "|")
    If $string = "" Then Return SetError(1, 0, 0)
    Local $aTemp = StringRegExp($string, "(.*\" & $delimiter & ".*)", 3), $aTmp, $i, $j
    Local $2DArray[UBound($aTemp)][8]
    For $i = 0 To UBound($aTemp) - 1
    $aTmp = StringSplit($aTemp[$i], $delimiter)
    For $j = 1 To $aTmp[0]
    $2DArray[$i][$j - 1] = $aTmp[$j]
    Next
    Next
    _ArraySort($2DArray, 0, 0, 0, 1)
    Return SetError(0, 0, $2DArray)
    EndFunc ;==>Create2DArray

    [/autoit]
  • hallo

    • Oscar
    • 2. Februar 2011 um 16:19

    Auch von mir ein "Herzlich willkommen"!
    Aber ein einfaches "Hallo" ist als Uservorstellung dann doch etwas arg wenig. ;)

  • Problem mit _GUICtrlListView_GetItemTextArray in Array schreiben

    • Oscar
    • 2. Februar 2011 um 16:15

    Dazu müsstest Du im Voraus ein 2D-Array erstellen und dann das Ergebnis von StringSplit umkopieren. Wenn allerdings die zweite Ebene variabel ist, dann ist das nicht einfach zu lösen.
    Benutze dann lieber eine temporäres Array wie in Post#4 gezeigt.

  • Treeview Hilfe

    • Oscar
    • 2. Februar 2011 um 16:10

    So müsste es passen:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiTreeView.au3>
    #include <ListViewConstants.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>

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

    $data = "SIC2|E:\AU3\SIC2|0|True||OK|Everyone|Full Access" & @LF & _
    "AU3$|E:\AU3|0|10|Coding Share|OK|Everyone|Full Access" & @LF & _
    "Output|E:\AU3\SIC2\Output|0|True||OK|Everyone|Full Access" & @LF & _
    "SDOC|E:\SDOC|0|True|Test Share|OK|Administrators|Full Access" & @LF & _
    "SDOC|E:\SDOC|0|True|Test Share|OK|Everyone|Change Access" & @LF & _
    "HPBin|E:\Hewlett-Packard\ESS Sizers\Profile Manager\Bin|0|True||OK|Everyone|Read Access" & @LF & _
    "wmpub|C:\wmpub|0|True||OK|Administrators|Full Access" & @LF & _
    "wmpub|C:\wmpub|0|True||OK|Everyone|Read Access" & @LF & _
    "wmpub|C:\wmpub|0|True||OK|Users|Change Access" & @LF & _
    "wmiislog|C:\wmpub\wmiislog|0|True||OK|Everyone|Full Access" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Guest|Full Access Denied" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Administrators|Full Access" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Everyone|Read Access" & @LF & _
    "AutoIt3$|C:\Program Files\AutoIt3|0|True||OK|Power Users|Change Access"

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

    $aData = Create2DArray($data)

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

    $hGUI = GUICreate("Test", 800, 600)
    $hTreeview = GUICtrlCreateTreeView(8, 144, 257, 362, BitOR($GUI_SS_DEFAULT_TREEVIEW,$TVS_EDITLABELS,$TVS_CHECKBOXES,$TVS_SINGLEEXPAND,$WS_BORDER))
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $hListview = GUICtrlCreateListView("Share|Path|Type|Max. Allowed|Description|Status|Account|Permission", 272, 144, 522, 362, BitOR($GUI_SS_DEFAULT_LISTVIEW,$LVS_AUTOARRANGE), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES))
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    GUISetState(@SW_SHOW)
    _GUICtrlListView_AddArray($hListview, $aData)
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, "shell32.dll", 85)
    _GUICtrlTreeView_SetNormalImageList($hTreeview, $hImage)

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

    _GUICtrlTreeView_BeginUpdate($hTreeview)
    $root = _GUICtrlTreeView_Add($hTreeview, 1, "Shares on TEST_System", 0, 0)
    For $i = 0 To UBound($aData) - 1
    $hItem = _GUICtrlTreeView_FindParent($hTreeview, $aData[$i][1], $root)
    If $hItem Then
    _GUICtrlTreeView_AddChild($hTreeview, $hItem, $aData[$i][1])
    Else
    _GUICtrlTreeView_AddChild($hTreeview, $root, $aData[$i][1])
    EndIf
    Next
    _GUICtrlTreeView_EndUpdate($hTreeview)
    _GUICtrlTreeView_Expand($hTreeview)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUIDelete($hGUI)
    Exit
    EndSwitch
    WEnd

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

    Func _GUICtrlTreeView_FindParent($hTreeview, $sSearch, $hRoot)
    Local $sText, $hItem, $hNextSibling = _GUICtrlTreeView_GetFirstChild($hTreeview, $hRoot)
    If $hNextSibling = 0 Then Return $hItem
    Do
    $sText = _GUICtrlTreeView_GetText($hTreeview, $hNextSibling)
    If StringInStr($sSearch, $sText) Then
    If _GUICtrlTreeView_GetChildCount($hTreeview, $hNextSibling) > 0 Then $hItem = _GUICtrlTreeView_FindParent($hTreeview, $sSearch, $hNextSibling)
    If $hItem > 0 Then Return $hItem
    $hItem = $hNextSibling
    EndIf
    If $sSearch = $sText Then $hItem = -1
    $hNextSibling = _GUICtrlTreeView_GetNextSibling($hTreeview, $hNextSibling)
    Until $hNextSibling = 0
    Return $hItem
    EndFunc

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

    Func Create2DArray($string, $delimiter = "|")
    If $string = "" Then Return SetError(1, 0, 0)
    Local $aTemp = StringRegExp($string, "(.*\" & $delimiter & ".*)", 3), $aTmp, $i, $j
    Local $2DArray[UBound($aTemp)][8]
    For $i = 0 To UBound($aTemp) - 1
    $aTmp = StringSplit($aTemp[$i], $delimiter)
    For $j = 1 to $aTmp[0]
    $2DArray[$i][$j - 1] = $aTmp[$j]
    Next
    Next
    _ArraySort($2DArray, 0, 0, 0, 1)
    Return SetError(0, 0, $2DArray)
    EndFunc

    [/autoit]
  • Problem mit _GUICtrlListView_GetItemTextArray in Array schreiben

    • Oscar
    • 2. Februar 2011 um 14:28

    Der Fehler liegt darin, dass Du damit kein 2D-Array erzeugst, sondern ein Array im Array, was sich in AutoIt nicht direkt ansprechen lässt.
    Du musst das Array temporär in eine Array-Variable kopieren:

    [autoit]


    #include <Array.au3>
    Global $Array[4]
    $Array[2] = StringSplit("Blib,Blub,Blab", ",")
    _ArrayDisplay($Array[2])
    $aTmp = $Array[2]
    MsgBox(1, "X", $aTmp[2])

    [/autoit]

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™