Drag and drop fehler

  • kann einer den Fehler finden? ?( ?( ?( (skript ist ein bisschen unnordentlich)

    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, 650, 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, 350, 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)
    Next

    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]

    Einmal editiert, zuletzt von JuraX (23. Januar 2010 um 23:27)

  • Hallo Jura,

    kann einer den Fehler finden? ?( ?( ?( (skript ist ein bisschen unnordentlich)

    ein bisschen :?:
    Da das Skript sehr schlampig zusammenkopiert ist schlage ich vor, du bringst dein Skript in eine Form, die einigermassen den Konventionen entspricht siehe:

    Ok daran lags nicht.
    JuraX vielleiht hilft es schon dein Skript etwas "aufzuräumen"
    Includes -> Deklaration & Wertzuweisung der Variablen (Gui usw.) -> While Wend Schleife -> Funktionen
    So ca.

    dies wäre sicherlich hilfreicher, als hier einen Doppelten Thread zu eröffnen.
    Ich kann mir nicht vorsellen, dass sich diese Mühe macht dir zu helfen, solange du nicht bereit bist eine einigermassen vernünftige Grundlage einzustellen,

    hier noch ein Tip

    mfg Auto)Bert

  • So jetzt hab ich das ganze mal umgestellt


    Spoiler anzeigen
    [autoit]

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

    [/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 "Func`s"

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

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

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

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

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

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

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

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

    #EndRegion

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

    $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.dll")
    _BASS_Init (0, -1, 44100, 0, "")

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

    If @error Then
    MsgBox(0, "Error", "Sound konnte nicht Initialisiert werden!")
    Exit
    EndIf

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

    $file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
    $MusicHandle = _BASS_StreamCreateFile (False, $file, 0, 0, 0)
    $song_length = _BASS_ChannelGetLength ($MusicHandle, $BASS_POS_BYTE)

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

    If @error Then
    MsgBox(0, "Error", "Konnte Audiodatei nicht laden!" & @CR & "Error = " & @error)
    Exit
    EndIf

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

    AdLibRegister("Aktualisieren", 100)
    $Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115)
    $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)

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

    While (True)
    $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][/autoit] [autoit]

    $nMsg = GUIGetMsg()
    Switch $nMsg
    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

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

    If $progress_slider =100 Then
    $play_pause
    EndIf

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

    Func OnAutoItExit()
    _BASS_Free()
    EndFunc

    [/autoit]
  • Und dann das ganze nochmal richtig:

    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)
    #EndRegion StartUp

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

    #Region GUI
    $Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115)
    $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]

    If $progress_slider = 100 Then
    $play_pause
    EndIf

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

    $nMsg = GUIGetMsg()
    Switch $nMsg
    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
    #EndRegion Func's

    [/autoit]
  • Hallo Jura,

    du solltest die includes auch zum download einstellen, da man ansonsten das Skript nicht starten kann:

    mfg (Auto)Bert

    P(r)ost: 1111

  • Spoiler anzeigen
    [autoit]


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

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

    #NoTrayIcon

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

    #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

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

    #Region GUI
    $Form1 = GUICreate("INRadio-Localtuner", 380, 650, 193, 115, Default, $WS_EX_ACCEPTFILES) ;-> Style beachten
    $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
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE, $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
    #EndRegion Loop

    [/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]
  • Das ist auch nur ein Drag & Drop Beispiel.
    Dazu habe ich fast alles unnötige rausgelöscht, eine kleine Transferaufgabe ;)

    P.S. Natürlich nicht um dich zu ärgern, sondern wegen der Bass-Funktionen.
    Ist doch nur eine Zeile zu ändern, dein Fehler ist im Beispiel auch kommentiert.

  • da ist doch ein komplettes beispiel von BugFix drin

    oder hast du probleme mit dem beispiel?

    Spoiler anzeigen
    [autoit]

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

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

    $gui = GUICreate('test')
    $ListView = GUICtrlCreateListView('Spalte1|Spalte2', 10, 10, 300, 200, -1, BitOR($LVS_EX_FULLROWSELECT,$LVS_EX_TRACKSELECT))
    $hListView = GUICtrlGetHandle($ListView)
    _GUICtrlListView_SetColumnWidth($hListView, 0, 146)
    _GUICtrlListView_SetColumnWidth($hListView, 1, $LVSCW_AUTOSIZE_USEHEADER)
    For $i = 1 To 10
    GUICtrlCreateListViewItem('Zeile ' & $i & ' Spalte 1|Zeile ' & $i & ' Spalte 2', $ListView)
    Next
    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

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

    Do
    $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

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

    [/autoit]
  • ich suche wie man den pfad lesen kann bevor er in der tabelle ist(also beim droppen)

    2 Mal editiert, zuletzt von JuraX (23. Januar 2010 um 22:50)