playliste erstellen

  • kann mir mal jemand ein beispiel/anweisung geben wie ich eine playliste mit drag_drop machen kann ich kriegs zum verrecken nicht hin
    v.g.
    JuraX

  • ich hab das gefunden er nimmt aber kein D'aD an

    Spoiler anzeigen
    [autoit]

    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    $hGui = GUICreate('Listview Drag & Drop', 640, 480, -1, 0, Default, $WS_EX_ACCEPTFILES) ; $WS_EX_ACCEPTFILES als Extended Style
    $hListView = GUICtrlCreateListView('Dateiname', 10, 10, 620, 400)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; Control als Drop-Control einrichten
    GUISetState()
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($hGui, '', 1)

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    Case $GUI_EVENT_DROPPED
    For $i = 0 To UBound($gaDropFiles) - 1
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
    Next
    EndSwitch
    WEnd

    [/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]
    • Offizieller Beitrag
    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <GuiListView.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233
    $hGui = GUICreate('Listview Drag & Drop', 640, 480, -1, 0, Default, $WS_EX_ACCEPTFILES) ; $WS_EX_ACCEPTFILES als Extended Style
    $hListView = GUICtrlCreateListView('Dateiname', 10, 10, 620, 400)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; Control als Drop-Control einrichten
    GUISetState()
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($hGui, '', 1)

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    Case $GUI_EVENT_DROPPED
    For $i = 0 To UBound($gaDropFiles) - 1
    GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
    Next
    EndSwitch
    WEnd

    [/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]

    Die Includes haben gefehlt. Das Beispiel funzt bei mir einwandfrei.

  • das funktioniert schon mal aber wießo eingebunden nicht mehr?

    ?( ?( ?( ?(

    Spoiler anzeigen
    [autoit]

    Local $progress_slider ,$slots, $Form1
    #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][/autoit] [autoit]

    Global $gaDropFiles[1]
    Global Const $WM_DROPFILES = 0x0233

    [/autoit] [autoit][/autoit] [autoit][/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
    Func Aktualisieren()
    $Sliderstatus = GUICtrlRead($progress_slider)
    GUICtrlSetData($slots, $Sliderstatus)
    EndFunc
    Func _BASS_ChannelSetVolume($hChannel, $nVol)
    Local $ret = _BASS_ChannelSetAttribute($hChannel,$BASS_ATTRIB_VOL,$nVol)
    Return SetError(@error,@extended,$ret)
    EndFunc
    Func _BASS_ChannelGetVolume($hChannel)
    Local $ret = _BASS_ChannelGetAttribute($hChannel,$BASS_ATTRIB_VOL)
    Return SetError(@error,@extended,$ret)
    EndFunc

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

    AdLibRegister("Aktualisieren", 100)
    $firststart = IniRead("INRadio.ini","Start","firststart","")

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

    ;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]

    Global $playing_state = -1
    ;Open Bass.DLL. Required for all function calls.
    _BASS_STARTUP ("BASS.dll")

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

    ;Initalize bass. Required for most functions.
    _BASS_Init (0, -1, 44100, 0, "")

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

    ;Check if bass iniated. If not, we cannot continue.
    If @error Then
    MsgBox(0, "Error", "Could not initialize audio")
    Exit
    EndIf

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

    ;Prompt the user to select a MP3 file
    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")

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

    ;Create a stream from that file.
    $MusicHandle = _BASS_StreamCreateFile (False, $file, 0, 0, 0)

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

    ;Check if we opened the file correctly.
    If @error Then
    MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    ;Create GUI and controls
    $Form1 = GUICreate("INRadio-Localtuner", 380, 450, 193, 115)
    $progress_slider = GUICtrlCreateProgress(8, 32, 366, 20)
    $Volume_slider1 = GUICtrlCreateSlider(8,210,366,80)
    $Volume_slider2 = GUICtrlCreateSlider(8,292,366,80)
    GUICtrlSetLimit(-1,100,0)
    GUICtrlSetData($Volume_Slider1,50)
    GUICtrlSetData($Volume_Slider2,50)
    GUICtrlCreateLabel("Lautstärke",8,190,80,20)
    GUICtrlSetLimit(-1, 100, 0)
    $hListView = GUICtrlCreateListView('Dateiname', 10, 375, 150, 200)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; Control als Drop-Control einrichten
    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
    WinSetOnTop($Form1, '', 1)
    $rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    $LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
    GUICtrlSetLimit(-1, 100, 0)
    $slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider)& "%",8, 8, 150, 17)
    ;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)
    GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
    GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)
    $Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
    $Play_pause = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
    $Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
    $newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
    ;Show GUI
    GUISetState(@SW_SHOW)

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

    ;Get the length of the song in bytes.
    $song_length = _BASS_ChannelGetLength ($MusicHandle, $BASS_POS_BYTE)

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

    While 1
    ;Get Current playback position
    $current = _BASS_ChannelGetPosition ($MusicHandle, $BASS_POS_BYTE)
    ;Calculate the percentage
    $percent = Round(($current / $song_length) * 100, 0)
    ;Set the slider to show percent
    GUICtrlSetData($progress_slider, $percent)

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

    ;Get Right/Left Playback Levels
    $levels = _BASS_ChannelGetLevel ($MusicHandle)
    ;Get Right and calculate percentage
    $rightChLvl = _LoWord ($levels)
    $rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
    ;Get Left and calculate percentage
    $LeftChLvl = _HiWord ($levels)
    $leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
    ;Set the levels on GUI.
    GUICtrlSetData($rightVol, $rightChLvlper)
    GUICtrlSetData($LeftVol, $leftChLvlper)

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

    ;Get GUI Message
    $nMsg = GUIGetMsg()
    Switch $nMsg
    ;If Close button or red x, then exit. Alway remember to free resources
    Case $GUI_EVENT_CLOSE, $Close
    ProcessClose("Radiotuner.exe")
    AdLibUnRegister("Aktualisieren")
    Exit
    Case $Play_pause
    ;Check if playing or paused, then take appropriate action
    Switch $playing_state
    Case - 1 ; Song stopped, start from begining.
    ;Play Song
    _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)

    Case $Stop
    ;Stop Song
    _BASS_ChannelStop ($MusicHandle)

    $playing_state = -1
    EndSwitch
    WEnd

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

    If $progress_slider =100 Then
    $play_pause
    EndIf

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

    Func OnAutoItExit()
    ;Free Resources
    _BASS_Free()
    EndFunc ;=

    [/autoit]
    • Offizieller Beitrag

    GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC') vergessen?
    Nimms mir nicht übel, aber einfach Skripte zusammenkopieren wird dich langfristig nicht ans Ziel bringen. ;)

    Schau mal in Zeile 94. ;) Das Script ist aber so dermaßen durcheinenadergeschafft, das man nirgends mehr durchblickt.