Listview object

  • ich habe ein listviev als playliste und möchte nun das der pfad des objects beim droppen gespeichert wird und beim doppelcklick $file duch den pfad ersetzt wird

    vg
    JuraX

    Spoiler anzeigen
    [autoit]

    ;===================================================================================================
    ; INRadio-Localtuner by JuraX
    ;===================================================================================================

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

    #NoTrayIcon
    #include <Bass.au3>
    #include <BassConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <sound.au3>
    #include <WindowsConstants.au3>

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

    #Region StartUp
    Local $progress_slider, $slots, $Form1
    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    Global $playing_state = -1

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

    ;First Start
    $firststart = IniRead("INRadio.ini", "Start", "firststart", "")
    If $firststart = "" Then
    MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    Exit
    ElseIf ProcessExists("Radiotuner.exe") Then
    Else
    MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    Exit
    EndIf

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

    ;Bass StartUp
    _BASS_STARTUP("BASS.dll")
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
    MsgBox(0, "Error", "Sound konnte nicht Initialisiert werden!")
    Exit
    EndIf

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

    ;File Open
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    If @error Then
    MsgBox(0, "Error", "Konnte Audiodatei nicht laden!" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    ;Sonstiges
    AdlibRegister("Aktualisieren", 100)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

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

    #EndRegion StartUp

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

    #Region GUI
    $Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115, Default, $WS_EX_ACCEPTFILES)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    $newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
    $progress_slider = GUICtrlCreateProgress(8, 32, 366, 20)
    $slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider) & "%", 8, 8, 150, 17)
    ;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)

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

    GUICtrlCreateLabel("Lautstärke", 8, 190, 80, 20)
    $Volume_slider1 = GUICtrlCreateSlider(8, 210, 366, 80)
    GUICtrlSetData($Volume_slider1, 50)
    GUICtrlSetLimit(-1, 100, 0)
    $Volume_slider2 = GUICtrlCreateSlider(8, 292, 366, 80)
    GUICtrlSetData($Volume_slider2, 50)
    GUICtrlSetLimit(-1, 100, 0)

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

    $hListView = GUICtrlCreateListView('Dateiname', 10, 375, 350, 200)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($Form1, '', 1)

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

    $rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
    $LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)

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

    GUISetState(@SW_SHOW)
    #EndRegion GUI

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

    #Region Loop
    While 1
    $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $percent = Round(($current / $song_length) * 100, 0)
    GUICtrlSetData($progress_slider, $percent)

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

    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $rightChLvl = _LoWord($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    $LeftChLvl = _HiWord($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)

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

    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE, $Close
    ProcessClose("Radiotuner.exe")
    AdlibUnRegister("Aktualisieren")
    Exit
    Case $Play
    Switch $playing_state
    Case -1
    _BASS_ChannelPlay($MusicHandle, 1)
    $playing_state = 1
    EndSwitch
    Case $newfile
    _BASS_ChannelStop($MusicHandle)
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelStop($MusicHandle)
    Case $Volume_slider1
    _BASS_ChannelSetVolume($MusicHandle, GUICtrlRead($Volume_slider1) / 100)
    Case $Volume_slider2
    SoundSetWaveVolume(GUICtrlRead($Volume_slider2))
    Case $GUI_EVENT_DROPPED
    For $i = 0 To UBound($gaDropFiles) - 1
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
    Next
    Case $Stop
    _BASS_ChannelStop($MusicHandle)
    $playing_state = -1
    EndSwitch
    WEnd
    #EndRegion Loop

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

    #Region Func's
    Func OnAutoItExit()
    _BASS_Free()
    EndFunc ;==>OnAutoItExit

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

    Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
    Local $nSize, $pFileName
    Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
    For $i = 0 To $nAmt[0] - 1
    $nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
    $nSize = $nSize[0] + 1
    $pFileName = DllStructCreate('wchar[' & $nSize & ']')
    DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
    ReDim $gaDropFiles[$i + 1]
    $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
    $pFileName = 0
    Next
    EndFunc ;==>WM_DROPFILES_FUNC

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

    Func Aktualisieren()
    $Sliderstatus = GUICtrlRead($progress_slider)
    GUICtrlSetData($slots, $Sliderstatus)
    EndFunc ;==>Aktualisieren

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

    Func _BASS_ChannelSetVolume($hChannel, $nVol)
    Local $ret = _BASS_ChannelSetAttribute($hChannel, $BASS_ATTRIB_VOL, $nVol)
    Return SetError(@error, @extended, $ret)
    EndFunc ;==>_BASS_ChannelSetVolume

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

    Func _BASS_ChannelGetVolume($hChannel)
    Local $ret = _BASS_ChannelGetAttribute($hChannel, $BASS_ATTRIB_VOL)
    Return SetError(@error, @extended, $ret)
    EndFunc ;==>_BASS_ChannelGetVolume

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

    Func _LeftDblClick($aInfo)
    Local $sMsg = 'Doppelklick auf:' & @LF & 'ZeilenIndex: ' & $aInfo[3] & @LF & _
    'Spaltenindex: ' & $aInfo[4] & @LF & _
    'Zellen Text: ' & _GUICtrlListView_GetItemText($hListView, $aInfo[3], $aInfo[4])
    MsgBox(0, 'Doppelklick', $sMsg)
    EndFunc

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

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

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    Local $aInfo[12] = [$hWndFrom, _
    $iIDFrom, _
    $iCode, _
    DllStructGetData($tInfo, "Index"), _
    DllStructGetData($tInfo, "SubItem"), _
    DllStructGetData($tInfo, "NewState"), _
    DllStructGetData($tInfo, "OldState"), _
    DllStructGetData($tInfo, "Changed"), _
    DllStructGetData($tInfo, "ActionX"), _
    DllStructGetData($tInfo, "ActionY"), _
    DllStructGetData($tInfo, "lParam"), _
    DllStructGetData($tInfo, "KeyFlags")]
    _LeftDblClick($aInfo)
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY
    #EndRegion Func's

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

    2 Mal editiert, zuletzt von JuraX (24. Januar 2010 um 10:17)

  • Willste die in ne INI speichern? Und könntest du vielleicht die Bass.au3 auch mit anhängen.

  • Halo JuraX,

    da die Bass-Includes immer noch fehlen so:

    Spoiler anzeigen
    [autoit]

    ;===================================================================================================
    ; INRadio-Localtuner by JuraX
    ;===================================================================================================

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

    #NoTrayIcon
    ;#include <Bass.au3>
    ;#include <BassConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <sound.au3>
    #include <WindowsConstants.au3>

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

    #Region StartUp
    Local $progress_slider, $slots, $Form1
    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    Global $playing_state = -1

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

    #cs
    ;First Start
    $firststart = IniRead("INRadio.ini", "Start", "firststart", "")
    If $firststart = "" Then
    MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    Exit
    ElseIf ProcessExists("Radiotuner.exe") Then
    Else
    MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    Exit
    EndIf

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

    ;Bass StartUp
    _BASS_STARTUP("BASS.dll")
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
    MsgBox(0, "Error", "Sound konnte nicht Initialisiert werden!")
    Exit
    EndIf

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

    ;File Open
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    If @error Then
    MsgBox(0, "Error", "Konnte Audiodatei nicht laden!" & @CR & "Error = " & @error)
    Exit
    EndIf
    #ce

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

    ;Sonstiges
    AdlibRegister("Aktualisieren", 100)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

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

    #EndRegion StartUp

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

    #Region GUI
    $Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115, Default, $WS_EX_ACCEPTFILES)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    $newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
    $progress_slider = GUICtrlCreateProgress(8, 32, 366, 20)
    $slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider) & "%", 8, 8, 150, 17)
    ;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)

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

    GUICtrlCreateLabel("Lautstärke", 8, 190, 80, 20)
    $Volume_slider1 = GUICtrlCreateSlider(8, 210, 366, 80)
    GUICtrlSetData($Volume_slider1, 50)
    GUICtrlSetLimit(-1, 100, 0)
    $Volume_slider2 = GUICtrlCreateSlider(8, 292, 366, 80)
    GUICtrlSetData($Volume_slider2, 50)
    GUICtrlSetLimit(-1, 100, 0)

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

    $hListView = GUICtrlCreateListView('Dateiname|Pfad', 10, 375, 350, 200)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($Form1, '', 1)

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

    $rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
    $LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)

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

    GUISetState(@SW_SHOW)
    #EndRegion GUI

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

    #Region Loop
    While 1
    #cs
    $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $percent = Round(($current / $song_length) * 100, 0)
    GUICtrlSetData($progress_slider, $percent)

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

    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $rightChLvl = _LoWord($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    $LeftChLvl = _HiWord($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)
    #ce
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE, $Close
    ProcessClose("Radiotuner.exe")
    AdlibUnRegister("Aktualisieren")
    Exit
    #cs
    Case $Play
    Switch $playing_state
    Case -1
    _BASS_ChannelPlay($MusicHandle, 1)
    $playing_state = 1
    EndSwitch
    Case $newfile
    _BASS_ChannelStop($MusicHandle)
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelStop($MusicHandle)
    Case $Volume_slider1
    _BASS_ChannelSetVolume($MusicHandle, GUICtrlRead($Volume_slider1) / 100)
    Case $Volume_slider2
    #ce
    SoundSetWaveVolume(GUICtrlRead($Volume_slider2))
    Case $GUI_EVENT_DROPPED
    ;_ArrayDisplay($gaDropFiles)
    For $i = 0 To UBound($gaDropFiles) - 2 ;kommt derzeit immer noch ein leerer Eintrag am schluss
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1')& "|" & $gaDropFiles[$i], $hListView)
    Next
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE) ;erst wenn alle eigefügt sind
    Case $Stop
    ; _BASS_ChannelStop($MusicHandle)
    $playing_state = -1
    EndSwitch
    WEnd
    #EndRegion Loop

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

    #Region Func's
    Func OnAutoItExit()
    ; _BASS_Free()
    EndFunc ;==>OnAutoItExit

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

    Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
    Local $nSize, $pFileName ; Original von UEZ http://www.autoit.de/index.php?page…4119#post134119
    Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
    For $i = 0 To $nAmt[0]
    $nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
    $nSize = $nSize[0] + 1
    $pFileName = DllStructCreate('wchar[' & $nSize & ']')
    DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
    $filename = DllStructGetData($pFileName, 1) ;Dateinamen holen
    ConsoleWrite($filename & @CRLF)
    ReDim $gaDropFiles[$i + 1]
    $gaDropFiles[$i] = $filename ;DllStructGetData($pFileName, 1)
    $pFileName = 0
    Next
    EndFunc ;==>WM_DROPFILES_FUNC

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

    Func Aktualisieren()
    $Sliderstatus = GUICtrlRead($progress_slider)
    GUICtrlSetData($slots, $Sliderstatus)
    EndFunc ;==>Aktualisieren

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

    Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) ;<================== Benachrichtigung Doppelklick from Chaoskeks (in ChaosExecution)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $hListView And $code = -3 And _GUICtrlListView_GetSelectedCount($hListView) > 0 Then
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView)
    IF _GUICtrlListView_GetItemSelected($hListView, $i) Then
    $aItem = _GUICtrlListView_GetItemTextArray($hlistview, $i)
    MsgBox(0,"Doppel-Klick auf ",$aItem[1] & @CRLF & @CRLF & $aItem[2])
    ShellExecute($aItem[2])
    EndIf
    Next
    Endif
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    #cs

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

    Func _BASS_ChannelSetVolume($hChannel, $nVol)
    Local $ret = _BASS_ChannelSetAttribute($hChannel, $BASS_ATTRIB_VOL, $nVol)
    Return SetError(@error, @extended, $ret)
    EndFunc ;==>_BASS_ChannelSetVolume

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

    Func _BASS_ChannelGetVolume($hChannel)
    Local $ret = _BASS_ChannelGetAttribute($hChannel, $BASS_ATTRIB_VOL)
    Return SetError(@error, @extended, $ret)
    EndFunc ;==>_BASS_ChannelGetVolume

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

    Func _LeftDblClick($aInfo)
    Local $sMsg = 'Doppelklick auf:' & @LF & 'ZeilenIndex: ' & $aInfo[3] & @LF & _
    'Spaltenindex: ' & $aInfo[4] & @LF & _
    'Zellen Text: ' & _GUICtrlListView_GetItemTextArray($hListView, $aInfo[3], $aInfo[4])
    MsgBox(0, 'Doppelklick ', $sMsg)
    EndFunc

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

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

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    Local $aInfo[12] = [$hWndFrom, _
    $iIDFrom, _
    $iCode, _
    DllStructGetData($tInfo, "Index"), _
    DllStructGetData($tInfo, "SubItem"), _
    DllStructGetData($tInfo, "NewState"), _
    DllStructGetData($tInfo, "OldState"), _
    DllStructGetData($tInfo, "Changed"), _
    DllStructGetData($tInfo, "ActionX"), _
    DllStructGetData($tInfo, "ActionY"), _
    DllStructGetData($tInfo, "lParam"), _
    DllStructGetData($tInfo, "KeyFlags")]
    _LeftDblClick($aInfo)
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY
    #EndRegion Func's
    #ce

    [/autoit]

    der komplette Pfad wird jetzt in die LV in der 2. Spalte gespeichert, die Doppelklick-Func habe ich ausgewechselt gegen eine von <ChaosKeks (von mir angepasst).
    Die 2. Spalte kann man auch mit Länge 0 verstecken, aber diese Zeile kaannst du ja noch einbauen
    viel Spass damit,

  • Halo JuraX,

    da die Bass-Includes immer noch fehlen so:

    Spoiler anzeigen
    [autoit]

    ;===================================================================================================
    ; INRadio-Localtuner by JuraX
    ;===================================================================================================

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

    #NoTrayIcon
    ;#include <Bass.au3>
    ;#include <BassConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <sound.au3>
    #include <WindowsConstants.au3>

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

    #Region StartUp
    Local $progress_slider, $slots, $Form1
    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    Global $playing_state = -1

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

    #cs
    ;First Start
    $firststart = IniRead("INRadio.ini", "Start", "firststart", "")
    If $firststart = "" Then
    MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    Exit
    ElseIf ProcessExists("Radiotuner.exe") Then
    Else
    MsgBox(0, "Warnung!", "Bitte über den Radiotuner Starten!")
    Exit
    EndIf

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

    ;Bass StartUp
    _BASS_STARTUP("BASS.dll")
    _BASS_Init(0, -1, 44100, 0, "")
    If @error Then
    MsgBox(0, "Error", "Sound konnte nicht Initialisiert werden!")
    Exit
    EndIf

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

    ;File Open
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    If @error Then
    MsgBox(0, "Error", "Konnte Audiodatei nicht laden!" & @CR & "Error = " & @error)
    Exit
    EndIf
    #ce

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

    ;Sonstiges
    AdlibRegister("Aktualisieren", 100)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

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

    #EndRegion StartUp

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

    #Region GUI
    $Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115, Default, $WS_EX_ACCEPTFILES)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    $newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
    $progress_slider = GUICtrlCreateProgress(8, 32, 366, 20)
    $slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider) & "%", 8, 8, 150, 17)
    ;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)

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

    GUICtrlCreateLabel("Lautstärke", 8, 190, 80, 20)
    $Volume_slider1 = GUICtrlCreateSlider(8, 210, 366, 80)
    GUICtrlSetData($Volume_slider1, 50)
    GUICtrlSetLimit(-1, 100, 0)
    $Volume_slider2 = GUICtrlCreateSlider(8, 292, 366, 80)
    GUICtrlSetData($Volume_slider2, 50)
    GUICtrlSetLimit(-1, 100, 0)

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

    $hListView = GUICtrlCreateListView('Dateiname|Pfad', 10, 375, 350, 200)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($Form1, '', 1)

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

    $rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
    $LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)

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

    GUISetState(@SW_SHOW)
    #EndRegion GUI

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

    #Region Loop
    While 1
    #cs
    $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    $percent = Round(($current / $song_length) * 100, 0)
    GUICtrlSetData($progress_slider, $percent)

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

    $levels = _BASS_ChannelGetLevel($MusicHandle)
    $rightChLvl = _LoWord($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    $LeftChLvl = _HiWord($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)
    #ce
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE, $Close
    ProcessClose("Radiotuner.exe")
    AdlibUnRegister("Aktualisieren")
    Exit
    #cs
    Case $Play
    Switch $playing_state
    Case -1
    _BASS_ChannelPlay($MusicHandle, 1)
    $playing_state = 1
    EndSwitch
    Case $newfile
    _BASS_ChannelStop($MusicHandle)
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    _BASS_ChannelStop($MusicHandle)
    Case $Volume_slider1
    _BASS_ChannelSetVolume($MusicHandle, GUICtrlRead($Volume_slider1) / 100)
    Case $Volume_slider2
    #ce
    SoundSetWaveVolume(GUICtrlRead($Volume_slider2))
    Case $GUI_EVENT_DROPPED
    ;_ArrayDisplay($gaDropFiles)
    For $i = 0 To UBound($gaDropFiles) - 2 ;kommt derzeit immer noch ein leerer Eintrag am schluss
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1')& "|" & $gaDropFiles[$i], $hListView)
    Next
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE) ;erst wenn alle eigefügt sind
    Case $Stop
    ; _BASS_ChannelStop($MusicHandle)
    $playing_state = -1
    EndSwitch
    WEnd
    #EndRegion Loop

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

    #Region Func's
    Func OnAutoItExit()
    ; _BASS_Free()
    EndFunc ;==>OnAutoItExit

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

    Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
    Local $nSize, $pFileName ; Original von UEZ http://www.autoit.de/index.php?page…4119#post134119
    Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
    For $i = 0 To $nAmt[0]
    $nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
    $nSize = $nSize[0] + 1
    $pFileName = DllStructCreate('wchar[' & $nSize & ']')
    DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
    $filename = DllStructGetData($pFileName, 1) ;Dateinamen holen
    ConsoleWrite($filename & @CRLF)
    ReDim $gaDropFiles[$i + 1]
    $gaDropFiles[$i] = $filename ;DllStructGetData($pFileName, 1)
    $pFileName = 0
    Next
    EndFunc ;==>WM_DROPFILES_FUNC

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

    Func Aktualisieren()
    $Sliderstatus = GUICtrlRead($progress_slider)
    GUICtrlSetData($slots, $Sliderstatus)
    EndFunc ;==>Aktualisieren

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

    Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) ;<================== Benachrichtigung Doppelklick from Chaoskeks (in ChaosExecution)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $hListView And $code = -3 And _GUICtrlListView_GetSelectedCount($hListView) > 0 Then
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView)
    IF _GUICtrlListView_GetItemSelected($hListView, $i) Then
    $aItem = _GUICtrlListView_GetItemTextArray($hlistview, $i)
    MsgBox(0,"Doppel-Klick auf ",$aItem[1] & @CRLF & @CRLF & $aItem[2])
    ShellExecute($aItem[2])
    EndIf
    Next
    Endif
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

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

    #cs

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

    Func _BASS_ChannelSetVolume($hChannel, $nVol)
    Local $ret = _BASS_ChannelSetAttribute($hChannel, $BASS_ATTRIB_VOL, $nVol)
    Return SetError(@error, @extended, $ret)
    EndFunc ;==>_BASS_ChannelSetVolume

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

    Func _BASS_ChannelGetVolume($hChannel)
    Local $ret = _BASS_ChannelGetAttribute($hChannel, $BASS_ATTRIB_VOL)
    Return SetError(@error, @extended, $ret)
    EndFunc ;==>_BASS_ChannelGetVolume

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

    Func _LeftDblClick($aInfo)
    Local $sMsg = 'Doppelklick auf:' & @LF & 'ZeilenIndex: ' & $aInfo[3] & @LF & _
    'Spaltenindex: ' & $aInfo[4] & @LF & _
    'Zellen Text: ' & _GUICtrlListView_GetItemTextArray($hListView, $aInfo[3], $aInfo[4])
    MsgBox(0, 'Doppelklick ', $sMsg)
    EndFunc

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

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

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
    Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    Local $aInfo[12] = [$hWndFrom, _
    $iIDFrom, _
    $iCode, _
    DllStructGetData($tInfo, "Index"), _
    DllStructGetData($tInfo, "SubItem"), _
    DllStructGetData($tInfo, "NewState"), _
    DllStructGetData($tInfo, "OldState"), _
    DllStructGetData($tInfo, "Changed"), _
    DllStructGetData($tInfo, "ActionX"), _
    DllStructGetData($tInfo, "ActionY"), _
    DllStructGetData($tInfo, "lParam"), _
    DllStructGetData($tInfo, "KeyFlags")]
    _LeftDblClick($aInfo)
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY
    #EndRegion Func's
    #ce

    [/autoit]

    der komplette Pfad wird jetzt in die LV in der 2. Spalte gespeichert.
    Die 2. Spalte kann man auch mit Länge 0 verstecken, aber diese Zeile kaannst du ja noch einbauen
    Die Func WM_DROPFILES habe ich durch eine von UEZ ersetzt und etwas angepasst.
    Die Func WM_NOTIFY habe ich durch eine von ChaosKeks ersetzt und etwas angepasst.
    Alle Funktionen die in irgendeiner Weise etwas mit den BASS-Includes zu tun haben sind aauskommentiert.
    viel Spass damit

    mfg (Auto)Bert

    • Offizieller Beitrag
    Zitat

    der komplette Pfad wird jetzt in die LV in der 2. Spalte gespeichert.

    [autoit]

    Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) ;<================== Benachrichtigung Doppelklick from Chaoskeks (in ChaosExecution)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $hListView And $code = -3 And _GUICtrlListView_GetSelectedCount($hListView) > 0 Then
    For $i = 0 To _GUICtrlListView_GetItemCount($hListView)
    IF _GUICtrlListView_GetItemSelected($hListView, $i) Then
    $aItem = _GUICtrlListView_GetItemTextArray($hlistview, $i)
    MsgBox(0,"Doppel-Klick auf ",$aItem[1] & @CRLF & @CRLF & $aItem[2]);~ In aItem[1] steht der Dateiname und in $aItem[2] der Pfad zincl. Dateinamen
    ShellExecute($aItem[2])
    EndIf
    Next
    Endif
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIF

    [/autoit]


    Schau dir mal den Comment an.