Jump to content

image and list


Recommended Posts

i have this code:

#include <GUIConstants.au3>
#include <WMMedia.au3>
#include <File.au3>
#include <Constants.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>

Global Const $WM_NOTIFY = 0x004E
Global $DoubleClicked   = False
Global $Title

Local $hImage, $hListView

Opt("TrayMenuMode",1)
$restore = TrayCreateItem("Restore")
$mute = TrayCreateItem("Mute")
TrayItemSetState($mute, $TRAY_UNCHECKED)
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()
Opt("TrayIconHide", 1)
TraySetClick(8) ; Pressing secondary mouse button

HotKeySet("{DELETE}", "_DelKey")

$version = "v1.4" ; Version
$dir = @DesktopDir ; Radio.ini dir

$asd = 1

Global $play, $stop, $add, $addGui
WMStartPlayer()

$hGui = GUICreate("Radio Player "&$version, 380, 320, (@DesktopWidth-380)/2, (@DesktopHeight-320)/2)
$play = GUICtrlCreateButton("Play", 300, 10, 60, 30)
$stop = GUICtrlCreateButton("Stop", 300, 40, 60, 30)
$edit = GUICtrlCreateButton("Edit", 300, 70, 60, 30)
$delete = GUICtrlCreateButton("Delete", 300, 100, 60, 30)
$deleteall = GUICtrlCreateButton("Delete All", 300, 130, 60, 30)

$hListView = GuiCtrlCreateListView("", 10, 10, 250, 130)
_GUICtrlListView_InsertColumn($hListView, 0, "Title", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "URL", 300)

$label = GUICtrlCreateLabel("Playing: ", 10, 150, 280, 20)
GUICtrlCreateLabel("Volume: ", 10, 170, 50, 20)
GUICtrlCreateLabel("-", 58, 165, 20, 20)
GUICtrlSetFont(-1, 15)
$slider = GUICtrlCreateSlider(65, 165, 220, 30)
GUICtrlSetData($slider, 80)
GUICtrlCreateLabel("+", 290, 165, 20, 20)
GUICtrlSetFont(-1, 15)

GUICtrlCreateLabel("Title", 10, 210, 50, 20)
$input1 = GUICtrlCreateInput("", 50, 210, 250, 20)

GUICtrlCreateLabel("URL", 10, 250, 50, 20)
$input2 = GUICtrlCreateInput("", 50, 250, 250, 20)

$add = GUICtrlCreateButton("Add", 10, 280, 60, 30)
$clear = GUICtrlCreateButton("Clear", 80, 280, 60, 30)

GUICtrlCreateLabel("By Gil Hanan", 300, 300, 70, 20)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


$menu1=GUICtrlCreateContextMenu ($hListView)
$play2=GUICtrlCreateMenuitem("Play" , $menu1)
GUICtrlCreateMenuitem("", $menu1)
$edit2=GUICtrlCreateMenuitem("Edit" , $menu1)
GUICtrlCreateMenuitem("", $menu1)
$delete2=GUICtrlCreateMenuitem("Delete" , $menu1)
$deleteall2=GUICtrlCreateMenuitem("Delete All" , $menu1)

GUISetState()
_Refresh()

Func _Play()
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
    $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)
    $Title = _GUICtrlListView_GetItemText($hListView, $selected, 0)
    $URL = _GUICtrlListView_GetItemText($hListView, $selected, 1)
    
    If $iIndex = "" Then
        MsgBox(64, "Information", "Please select station")
    Else        
        MsgBox(0, "", $iIndex)
        WMOpenFile($URL)
        WMPlay($URL)
        $hImage = _GUIImageList_Create(16, 16, 5, 3)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 112)
        _GUICtrlListView_SetImageList($hListView, $hImage, 1)
        GUICtrlSetData($label, "Playing: "&$Title)
        WinActivate("Radio By G.H")
    EndIf
EndFunc

Func _Stop()
    WMStop()
    GUICtrlSetData($label, "Playing: ")
    $Title = ""
EndFunc

Func _Add()
    If GUICtrlRead($input1) = "" And GUICtrlRead($input2) = "" Then
        MsgBox(64, "Information", "Please insert URL and Title")
    Else
    
        If GUICtrlRead($input2) = "" Then
            MsgBox(64, "Information", "Please insert URL")
        Else
        If GUICtrlRead($input1) = "" Then
            MsgBox(64, "Information", "Please insert Title")
        Else

        If Not FileExists($dir&"\Radio.ini") Then
            $file2 = FileOpen($dir&"\Radio.ini", 1)
            FileClose($file2)
        EndIf
        
        $answer = _Search()
        
        If $answer = 1 Then
            $count = _FileCountLines($dir&"\Radio.ini")

            $file = FileOpen($dir&"\Radio.ini", 1)
            _FileWriteToLine($dir&"\Radio.ini", $count + 1, GUICtrlRead($input1), 1)
            _FileWriteToLine($dir&"\Radio.ini", $count + 2, GUICtrlRead($input2), 1)
            FileClose($file)
            _Refresh()
        Else
            MsgBox(64, "Information", "You already insert the URL: "&GUICtrlRead($input2))
        EndIf
    EndIf
    EndIf
    EndIf
EndFunc

Func _Search()
    $lines = _FileCountLines($dir&"\Radio.ini")
    For $i=2 To $lines Step 2
        If FileReadLine($dir&"\Radio.ini", $i) = GUICtrlRead($input2) Then
            Return(0)
        EndIf
    Next
    Return(1)
EndFunc

Func _Refresh()
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
    If FileExists($dir&"\Radio.ini") Then
        $stations = _FileCountLines($dir&"\Radio.ini")
        $z=0
        For $i=1 To $stations Step 2
            $titler = FileReadLine($dir&"\Radio.ini", $i)
            $urlr = FileReadLine($dir&"\Radio.ini", $i+1)
            _GUICtrlListView_AddItem($hListView, $titler)
            _GUICtrlListView_AddSubItem($hListView, $z, $urlr, 1)
            $z+=1
        Next
    EndIf
EndFunc


Func _Delete()
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
    $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)
    
    If $iIndex = "" Then
        MsgBox(64, "Information", "Please select station")
    Else
        $iIndex = $iIndex*2
        $lines = _FileCountLines($dir&"\Radio.ini")
        $file = FileOpen($dir&"\Radio.ini", 1)  
        
        If $lines <= 2 Then
            _FileWriteToLine($dir&"\Radio.ini", $iIndex+1, "", 1)
            _FileWriteToLine($dir&"\Radio.ini", $iIndex+1, "", 1)    
        Else    
            _FileWriteToLine($dir&"\Radio.ini", $iIndex+1, "", 1)
            _FileWriteToLine($dir&"\Radio.ini", $iIndex+1, "", 1) 
        EndIf
        
        FileClose($file)
        _Refresh()
    EndIf
EndFunc

Func _DelKey()
    $state = WinGetState("Radio Player "&$version, "")
    
    If BitAnd($state, 8) Then
        $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
        $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)
        
        If $iIndex = "" Then
           Return
        Else
            _Delete()
        EndIf
    Else
        Return
    EndIf 
EndFunc

Func _DeleteAll()
    $mbox = MsgBox(3, "Quetion", "You sure delete all list?")
    If $mbox = 6 Then
        FileDelete($dir&"\Radio.ini")
        FileOpen($dir&"\Radio.ini", 1)
        FileClose($dir&"\Radio.ini")
        _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
    Else
    EndIf
EndFunc

Func _OnDoubleclick()
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
    
    If $iIndex = "" Then
        Return
    Else
        _Play()
    EndIf
EndFunc 

Func _Mute()
    If $asd = 1 Then
        WmSetVolume(0)
        $asd = 0
        TrayItemSetState($mute, $TRAY_CHECKED)
    Else
        WmSetVolume($volume)
        $asd = 1
        TrayItemSetState($mute, $TRAY_UNCHECKED)
    EndIf
EndFunc

Func _Edit()
    $EditLine = _GUICtrlListView_GetNextItem ($hListView)
    If $EditLine <> -1 Then
        $Line = $EditLine*2
        $eTitle = _GUICtrlListView_GetItemText ($hListView, $EditLine, 0)
        $eURL = _GUICtrlListView_GetItemText ($hListView, $EditLine, 1)
        
        $Edit_GUI = GUICreate("Edit", 270, 120, -1, -1)
        
        GUICtrlCreateLabel("Title", 10, 10, 50, 20)
        $editTitle = GUICtrlCreateInput($eTitle, 50, 10, 250, 20)
        
        GUICtrlCreateLabel("URL", 10, 50, 50, 20)
        $editURL = GUICtrlCreateInput($eURL, 50, 50, 250, 20)
        
        $Edit_OK = GUICtrlCreateButton("OK", 10, 80, 60, 30)
        $Edit_Can = GUICtrlCreateButton("Cancle", 80, 80, 60, 30)
        GUISetState(@SW_SHOW)
        
        While 1
        GUISetState(@SW_SHOW)
        $nMsg = GUIGetMsg()
            If $nMsg = $GUI_EVENT_CLOSE Then 
                GUIDelete($Edit_GUI)
                Return
            EndIf
            If $nMsg = $Edit_Can Then 
                GUIDelete($Edit_GUI)
                Return
            EndIf
                
            If $nMsg = $Edit_OK Then
                    If GUICtrlRead($editTitle) = "" And GUICtrlRead($editURL) = "" Then
                        MsgBox(64, "Information", "Please insert URL and Title")
                    Else
                    
                        If GUICtrlRead($editURL) = "" Then
                            MsgBox(64, "Information", "Please insert URL")
                        Else
                        If GUICtrlRead($editTitle) = "" Then
                            MsgBox(64, "Information", "Please insert Title")
                        Else
                            $file = FileOpen($dir&"\Radio.ini", 1)
                            _FileWriteToLine($dir&"\Radio.ini", $Line + 1, GUICtrlRead($editTitle), 1)
                            _FileWriteToLine($dir&"\Radio.ini", $Line + 2, GUICtrlRead($editURL), 1)
                            FileClose($file)
                            GUIDelete($Edit_GUI)
                            _Refresh()
                            ExitLoop
                        EndIf
                        EndIf
                    EndIf    
            EndIf
        WEnd
    Else
    MsgBox(64, "Information", "Please select station")
    EndIf
EndFunc

Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
    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 Then $DoubleClicked = True
    Return $GUI_RUNDEFMSG
EndFunc


While 1    
    If $asd = 1 Then
        $volume = GUICtrlRead($slider)
        WmSetVolume($volume)        
    EndIf

    $state = WinGetState("Radio Player "&$version, "")

    If BitAnd($state, 8) Then
        HotKeySet("{DELETE}", "_DelKey")
    Else
        HotKeySet("{DELETE}")
    EndIf

    $mMsg = GUIGetMsg()
    $tMsg = TrayGetMsg()
        
    If $DoubleClicked Then
        _OnDoubleclick()
        $DoubleClicked = False
    EndIf    
    
    Select 
        Case $mMsg =$GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE)
            Opt("TrayIconHide", 0)
            
            If $Title = "" Then
                TrayTip("Note", "Nothing playing", 1000, 1)
            Else
                TrayTip("Note", $Title&" playing", 1000, 1)
            EndIf
        Case $mMsg = $GUI_EVENT_CLOSE
            WMClosePlayer()
            Exit
        Case $mMsg = $play
            _Play()
        Case $mMsg = $stop
            _Stop()    
        Case $mMsg = $edit
            _Edit()    
        Case $mMsg = $delete
            _Delete()    
        Case $mMsg = $deleteall
            _DeleteAll()    
        Case $mMsg = $add
            _Add()        
        Case $mMsg = $clear
            GUICtrlSetData($input1, "") 
            GUICtrlSetData($input2, "")    
        Case $mMsg = $play2
            _Play()                
        Case $mMsg = $edit2
            _Edit()            
        Case $mMsg = $delete2
            _Delete()
        Case $mMsg = $deleteall2
            _DeleteAll()
        Case $tMsg = $restore
            GUISetState(@SW_RESTORE)
            GUISetState(@SW_SHOW)
            Opt("TrayIconHide", 1)
        Case $tMsg = $mute
            _Mute()
        Case $tMsg = $exit
            WMClosePlayer()
            Exit
        Case $tMsg=$TRAY_EVENT_PRIMARYDOWN
            GUISetState(@SW_RESTORE)
            GUISetState(@SW_SHOW)
            Opt("TrayIconHide", 1)
    EndSelect
WEnd

i made it when user press on play all list get a some icon..

i want only the line that user play, get a image..

i dont know how make it.. some1?

Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <WMMedia.au3>
#include <File.au3>
#include <Constants.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>

Global Const $WM_NOTIFY = 0x004E
Global $DoubleClicked = False
Global $Title

Local $hImage, $hListView

Opt("TrayMenuMode", 1)
$restore = TrayCreateItem("Restore")
$mute = TrayCreateItem("Mute")
TrayItemSetState($mute, $TRAY_UNCHECKED)
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()
Opt("TrayIconHide", 1)
TraySetClick(8) ; Pressing secondary mouse button

HotKeySet("{DELETE}", "_DelKey")

$version = "v1.4" ; Version
$dir = @DesktopDir ; Radio.ini dir

$asd = 1

Global $play, $stop, $add, $addGui
WMStartPlayer()

$hGui = GUICreate("Radio Player " & $version, 380, 320, (@DesktopWidth - 380) / 2, (@DesktopHeight - 320) / 2)
$play = GUICtrlCreateButton("Play", 300, 10, 60, 30)
$stop = GUICtrlCreateButton("Stop", 300, 40, 60, 30)
$edit = GUICtrlCreateButton("Edit", 300, 70, 60, 30)
$delete = GUICtrlCreateButton("Delete", 300, 100, 60, 30)
$deleteall = GUICtrlCreateButton("Delete All", 300, 130, 60, 30)

$hListView = GUICtrlCreateListView("", 10, 10, 250, 130)
_GUICtrlListView_InsertColumn($hListView, 0, "Title", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "URL", 300)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 112)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

$label = GUICtrlCreateLabel("Playing: ", 10, 150, 280, 20)
GUICtrlCreateLabel("Volume: ", 10, 170, 50, 20)
GUICtrlCreateLabel("-", 58, 165, 20, 20)
GUICtrlSetFont(-1, 15)
$slider = GUICtrlCreateSlider(65, 165, 220, 30)
GUICtrlSetData($slider, 80)
GUICtrlCreateLabel("+", 290, 165, 20, 20)
GUICtrlSetFont(-1, 15)

GUICtrlCreateLabel("Title", 10, 210, 50, 20)
$input1 = GUICtrlCreateInput("", 50, 210, 250, 20)

GUICtrlCreateLabel("URL", 10, 250, 50, 20)
$input2 = GUICtrlCreateInput("", 50, 250, 250, 20)

$add = GUICtrlCreateButton("Add", 10, 280, 60, 30)
$clear = GUICtrlCreateButton("Clear", 80, 280, 60, 30)

GUICtrlCreateLabel("By Gil Hanan", 300, 300, 70, 20)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


$menu1 = GUICtrlCreateContextMenu($hListView)
$play2 = GUICtrlCreateMenuItem("Play", $menu1)
GUICtrlCreateMenuItem("", $menu1)
$edit2 = GUICtrlCreateMenuItem("Edit", $menu1)
GUICtrlCreateMenuItem("", $menu1)
$delete2 = GUICtrlCreateMenuItem("Delete", $menu1)
$deleteall2 = GUICtrlCreateMenuItem("Delete All", $menu1)

GUISetState()
_Refresh()

Func _Play()
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
    $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)
    $Title = _GUICtrlListView_GetItemText($hListView, $selected, 0)
    $URL = _GUICtrlListView_GetItemText($hListView, $selected, 1)

    If $iIndex = "" Then
        MsgBox(64, "Information", "Please select station")
    Else
        MsgBox(0, "", $iIndex)
        WMOpenFile($URL)
        WMPlay($URL)
        _GUICtrlListView_SetItem($hListView, $Title, $iIndex, 0, 0)
        GUICtrlSetData($label, "Playing: " & $Title)
        WinActivate("Radio By G.H")
    EndIf
EndFunc   ;==>_Play

Func _Stop()
    WMStop()
    GUICtrlSetData($label, "Playing: ")
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
    $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)
    $Title = _GUICtrlListView_GetItemText($hListView, $selected, 0)
    _GUICtrlListView_SetItem($hListView, $Title, $iIndex, 0, _GUIImageList_GetImageCount($hImage) + 1)
    $Title = ""
EndFunc   ;==>_Stop

Func _Add()
    If GUICtrlRead($input1) = "" And GUICtrlRead($input2) = "" Then
        MsgBox(64, "Information", "Please insert URL and Title")
    Else

        If GUICtrlRead($input2) = "" Then
            MsgBox(64, "Information", "Please insert URL")
        Else
            If GUICtrlRead($input1) = "" Then
                MsgBox(64, "Information", "Please insert Title")
            Else

                If Not FileExists($dir & "\Radio.ini") Then
                    $file2 = FileOpen($dir & "\Radio.ini", 1)
                    FileClose($file2)
                EndIf

                $answer = _Search()

                If $answer = 1 Then
                    $count = _FileCountLines($dir & "\Radio.ini")

                    $file = FileOpen($dir & "\Radio.ini", 1)
                    _FileWriteToLine($dir & "\Radio.ini", $count + 1, GUICtrlRead($input1), 1)
                    _FileWriteToLine($dir & "\Radio.ini", $count + 2, GUICtrlRead($input2), 1)
                    FileClose($file)
                    _Refresh()
                Else
                    MsgBox(64, "Information", "You already insert the URL: " & GUICtrlRead($input2))
                EndIf
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_Add

Func _Search()
    $lines = _FileCountLines($dir & "\Radio.ini")
    For $i = 2 To $lines Step 2
        If FileReadLine($dir & "\Radio.ini", $i) = GUICtrlRead($input2) Then
            Return (0)
        EndIf
    Next
    Return (1)
EndFunc   ;==>_Search

Func _Refresh()
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
    If FileExists($dir & "\Radio.ini") Then
        $stations = _FileCountLines($dir & "\Radio.ini")
        $z = 0
        For $i = 1 To $stations Step 2
            $titler = FileReadLine($dir & "\Radio.ini", $i)
            $urlr = FileReadLine($dir & "\Radio.ini", $i + 1)
            _GUICtrlListView_AddItem($hListView, $titler, _GUIImageList_GetImageCount($hImage) + 1)
            _GUICtrlListView_AddSubItem($hListView, $z, $urlr, 1)
            $z += 1
        Next
    EndIf
EndFunc   ;==>_Refresh


Func _Delete()
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
    $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)

    If $iIndex = "" Then
        MsgBox(64, "Information", "Please select station")
    Else
        $iIndex = $iIndex * 2
        $lines = _FileCountLines($dir & "\Radio.ini")
        $file = FileOpen($dir & "\Radio.ini", 1)

        If $lines <= 2 Then
            _FileWriteToLine($dir & "\Radio.ini", $iIndex + 1, "", 1)
            _FileWriteToLine($dir & "\Radio.ini", $iIndex + 1, "", 1)
        Else
            _FileWriteToLine($dir & "\Radio.ini", $iIndex + 1, "", 1)
            _FileWriteToLine($dir & "\Radio.ini", $iIndex + 1, "", 1)
        EndIf

        FileClose($file)
        _Refresh()
    EndIf
EndFunc   ;==>_Delete

Func _DelKey()
    $state = WinGetState("Radio Player " & $version, "")

    If BitAND($state, 8) Then
        $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)
        $selected = _GUICtrlListView_SetSelectionMark($hListView, $iIndex)

        If $iIndex = "" Then
            Return
        Else
            _Delete()
        EndIf
    Else
        Return
    EndIf
EndFunc   ;==>_DelKey

Func _DeleteAll()
    $mbox = MsgBox(3, "Quetion", "You sure delete all list?")
    If $mbox = 6 Then
        FileDelete($dir & "\Radio.ini")
        FileOpen($dir & "\Radio.ini", 1)
        FileClose($dir & "\Radio.ini")
        _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))
    Else
    EndIf
EndFunc   ;==>_DeleteAll

Func _OnDoubleclick()
    $iIndex = _GUICtrlListView_GetSelectedIndices($hListView)

    If $iIndex = "" Then
        Return
    Else
        _Play()
    EndIf
EndFunc   ;==>_OnDoubleclick

Func _Mute()
    If $asd = 1 Then
        WmSetVolume(0)
        $asd = 0
        TrayItemSetState($mute, $TRAY_CHECKED)
    Else
        WmSetVolume($volume)
        $asd = 1
        TrayItemSetState($mute, $TRAY_UNCHECKED)
    EndIf
EndFunc   ;==>_Mute

Func _Edit()
    $EditLine = _GUICtrlListView_GetNextItem($hListView)
    If $EditLine <> -1 Then
        $Line = $EditLine * 2
        $eTitle = _GUICtrlListView_GetItemText($hListView, $EditLine, 0)
        $eURL = _GUICtrlListView_GetItemText($hListView, $EditLine, 1)

        $Edit_GUI = GUICreate("Edit", 270, 120, -1, -1)

        GUICtrlCreateLabel("Title", 10, 10, 50, 20)
        $editTitle = GUICtrlCreateInput($eTitle, 50, 10, 250, 20)

        GUICtrlCreateLabel("URL", 10, 50, 50, 20)
        $editURL = GUICtrlCreateInput($eURL, 50, 50, 250, 20)

        $Edit_OK = GUICtrlCreateButton("OK", 10, 80, 60, 30)
        $Edit_Can = GUICtrlCreateButton("Cancle", 80, 80, 60, 30)
        GUISetState(@SW_SHOW)

        While 1
            GUISetState(@SW_SHOW)
            $nMsg = GUIGetMsg()
            If $nMsg = $GUI_EVENT_CLOSE Then
                GUIDelete($Edit_GUI)
                Return
            EndIf
            If $nMsg = $Edit_Can Then
                GUIDelete($Edit_GUI)
                Return
            EndIf

            If $nMsg = $Edit_OK Then
                If GUICtrlRead($editTitle) = "" And GUICtrlRead($editURL) = "" Then
                    MsgBox(64, "Information", "Please insert URL and Title")
                Else

                    If GUICtrlRead($editURL) = "" Then
                        MsgBox(64, "Information", "Please insert URL")
                    Else
                        If GUICtrlRead($editTitle) = "" Then
                            MsgBox(64, "Information", "Please insert Title")
                        Else
                            $file = FileOpen($dir & "\Radio.ini", 1)
                            _FileWriteToLine($dir & "\Radio.ini", $Line + 1, GUICtrlRead($editTitle), 1)
                            _FileWriteToLine($dir & "\Radio.ini", $Line + 2, GUICtrlRead($editURL), 1)
                            FileClose($file)
                            GUIDelete($Edit_GUI)
                            _Refresh()
                            ExitLoop
                        EndIf
                    EndIf
                EndIf
            EndIf
        WEnd
    Else
        MsgBox(64, "Information", "Please select station")
    EndIf
EndFunc   ;==>_Edit

Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
    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 Then $DoubleClicked = True
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY


While 1
    If $asd = 1 Then
        $volume = GUICtrlRead($slider)
        WmSetVolume($volume)
    EndIf

    $state = WinGetState("Radio Player " & $version, "")

    If BitAND($state, 8) Then
        HotKeySet("{DELETE}", "_DelKey")
    Else
        HotKeySet("{DELETE}")
    EndIf

    $mMsg = GUIGetMsg()
    $tMsg = TrayGetMsg()

    If $DoubleClicked Then
        _OnDoubleclick()
        $DoubleClicked = False
    EndIf

    Select
        Case $mMsg = $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE)
            Opt("TrayIconHide", 0)

            If $Title = "" Then
                TrayTip("Note", "Nothing playing", 1000, 1)
            Else
                TrayTip("Note", $Title & " playing", 1000, 1)
            EndIf
        Case $mMsg = $GUI_EVENT_CLOSE
            WMClosePlayer()
            Exit
        Case $mMsg = $play
            _Play()
        Case $mMsg = $stop
            _Stop()
        Case $mMsg = $edit
            _Edit()
        Case $mMsg = $delete
            _Delete()
        Case $mMsg = $deleteall
            _DeleteAll()
        Case $mMsg = $add
            _Add()
        Case $mMsg = $clear
            GUICtrlSetData($input1, "")
            GUICtrlSetData($input2, "")
        Case $mMsg = $play2
            _Play()
        Case $mMsg = $edit2
            _Edit()
        Case $mMsg = $delete2
            _Delete()
        Case $mMsg = $deleteall2
            _DeleteAll()
        Case $tMsg = $restore
            GUISetState(@SW_RESTORE)
            GUISetState(@SW_SHOW)
            Opt("TrayIconHide", 1)
        Case $tMsg = $mute
            _Mute()
        Case $tMsg = $exit
            WMClosePlayer()
            Exit
        Case $tMsg = $TRAY_EVENT_PRIMARYDOWN
            GUISetState(@SW_RESTORE)
            GUISetState(@SW_SHOW)
            Opt("TrayIconHide", 1)
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...