Sign in to follow this  
Followers 0
auemitpas

Radio player Tray

1 post in this topic

#1 ·  Posted (edited)

I want to make a player radio tray and got to a point where I do not know how to continue. I want that when I click on a station name to start, the point is I do not know how to identify registry item.

Where are the comments in the program there is problem solved

ModernMenuRaw.au3

RadioKiller!.au3

#include <GUIConstants.au3>
#include "ModernMenuRaw.au3"
#include <EditConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#NoTrayIcon

Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)

Global $Path = "HKEY_CURRENT_USERSOFTWARERadio KillerPosturi"
Global $TrayMenuIcon,$TrayMenu,$TextSideItem,$TrayMenuPosturi,$TrayMenuTools,$TrayMenuHelp,$TrayMenuExit,$TrayAdaugaPost,$TrayEliminaPost
Global $FormAddRadio,$GroupAddRadio,$GroupAddRadioName,$NumePostRadio,$GroupAddRadioStream,$NumeSteamRadio,$ButtonAddRadioOK,$ButtonAddRadioRenunta
Global $FormDeleteRadio,$GroupDeleteRadio,$ComboDeleteRadio,$ButtonDeleteRadioRenunta
Global $TrayItemRadio[100],$iCountItem,$oWMP
Dim $TrayMenuIcon2 = 0

_MenuTray()

While 1
Sleep(10)
WEnd

Func _MenuTray()
SetGreenMenuColors()
SetBlueTrayColors()
_SetFlashTimeOut(250)

$TrayMenuIcon = _TrayIconCreate("Tools", "shell32.dll", -13)
_TrayIconSetClick(-1, 1)
_TrayIconSetState()

$TrayMenu = _TrayCreateContextMenu()
$TextSideItem = _CreateSideMenu($TrayMenu)
_SetSideMenuText($TextSideItem, "Radio Online")
_SetSideMenuColor($TextSideItem, 0x00FFFF)
_SetSideMenuBkColor($TextSideItem, 0x802222)
_SetSideMenuBkGradColor($TextSideItem, 0x4477AA)

$TrayMenuPosturi = _TrayCreateMenu("Posturi")
_TrayItemSetIcon($TrayMenuPosturi, "shell32.dll", -21)
_TrayItemSetSelIcon($TrayMenuPosturi, "shell32.dll", -42)

$TrayMenuTools = _TrayCreateMenu("Setări")
_TrayItemSetIcon($TrayMenuTools, "shell32.dll", -20)
_TrayItemSetSelIcon($TrayMenuTools, "shell32.dll", -44)

_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)

$TrayMenuHelp = _TrayCreateItem("Help")
_TrayItemSetIcon($TrayMenuHelp, "shell32.dll", -24)
GUICtrlSetState($TrayMenuHelp, $GUI_DEFBUTTON)
GUICtrlSetOnEvent($TrayMenuHelp, "MenuEvents")

_TrayCreateItem("")
_TrayItemSetIcon(-1, "", 0)

$TrayMenuExit = _TrayCreateItem("Exit")
_TrayItemSetIcon($TrayMenuExit, "shell32.dll", -28)
GUICtrlSetOnEvent($TrayMenuExit, "MenuEvents")

$TrayAdaugaPost = _TrayCreateItem("Adaugă post", $TrayMenuTools)
GUICtrlSetOnEvent($TrayAdaugaPost, "MenuEvents")
_TrayItemSetIcon($TrayAdaugaPost, "regedit.exe", 0)

$TrayEliminaPost = _TrayCreateItem("Elimină post", $TrayMenuTools)
GUICtrlSetOnEvent($TrayEliminaPost, "MenuEvents")
_TrayItemSetIcon($TrayEliminaPost, "shell32.dll", -84)

_RegEnumValDataItem($Path)
$oWMP = ObjCreate ( "WMPLayer.ocx" )
$oWMP.controls.stop()
_TrayIconSetState()

EndFunc


Func MenuEvents()
Local $Msg = @GUI_CtrlID

Switch $Msg
Case $TrayMenuExit
_TrayIconDelete($TrayMenuIcon)
If $TrayMenuIcon2 > 0 Then _TrayIconDelete($TrayMenuIcon2)
Exit
Case $TrayMenuHelp
If $TrayMenuIcon2 = 0 Then
MsgBox(64, "About!", "Autoit ...")
EndIf
Case $TrayAdaugaPost
_AddRadio()
Case $TrayEliminaPost
_DeleteRadio()
Case $ButtonAddRadioOK
Local $numePost = GUICtrlRead( $numePostRadio )
Local $numeStream = GUICtrlRead( $NumeSteamRadio )
RegWrite($Path, $numePost, "REG_SZ", $numeStream)
MsgBox (0,"Post adăugat", "Ai adăugat cu succes postul de radio " & @CRLF & _
"Nume = " & $numePost & @CRLF & _
"Adresa = " & $numeStream)
$iCountItem += 1
$TrayItemRadio[$iCountItem] = _TrayCreateItem($numePost, $TrayMenuPosturi)
_TrayItemSetIcon($TrayItemRadio[$iCountItem], "", 0)
GUICtrlSetOnEvent($TrayItemRadio[$iCountItem], "MenuEvents")

GUICtrlSetData($NumePostRadio,"Nume...")
GUICtrlSetData($NumeSteamRadio,"Adresa...")
Case $ButtonAddRadioRenunta
GUIDelete($FormAddRadio)
Case $ButtonDeleteRadioRenunta
GUIDelete($FormDeleteRadio)
Case $ComboDeleteRadio
$AdresaDeSters = GUICtrlRead($ComboDeleteRadio)
If $AdresaDeSters <> "" Then
If $AdresaDeSters <> "Șterge postul de radio..." Then
$mesaj = MsgBox(4, "Atenție", "Vrei să ștergi postul de radio "& $AdresaDeSters)
If $mesaj = 6 Then
RegDelete($Path,$AdresaDeSters)
GUICtrlSetData($ComboDeleteRadio,"")
_RegEnumValDataItemDelete($Path)
;~ -------------###################-----------------
;~ Update RADIO LIST
;~ -------------###################-----------------

EndIf
EndIf
EndIf
Case $TrayItemRadio[$iCountItem]
;~ -------------###################-----------------
;~ Play Radio
;~ -------------###################-----------------
EndSwitch
EndFunc

Func _DeleteRadio()
$FormDeleteRadio = GUICreate("Sterge postul de radio!", 403, 134, 374, 288, 0, 0)
$GroupDeleteRadio = GUICtrlCreateGroup("Posturile de radio vor fi actualizate după repornirea programului...", 38, 8, 315, 73)
$ComboDeleteRadio = GUICtrlCreateCombo("", 104, 40, 193, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
_RegEnumValDataItemDelete($path)
GUICtrlSetOnEvent(-1, "MenuEvents")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ButtonDeleteRadioRenunta = GUICtrlCreateButton("Renunță", 280, 80, 75, 25)
GUICtrlSetOnEvent(-1, "MenuEvents")
GUISetState()
EndFunc


Func _RegEnumValDataItemDelete($sKeyName)
Local $iCount, $sRegEnumVal, $sRegRead, $sRet,$DataItemRadio = ""
Do
     $iCount += 1
     Local $sRegEnumVal = RegEnumVal($sKeyName, $iCount)
$DataItemRadio &= $sRegEnumVal & "|"
     If @error Then ExitLoop
Until $sRegEnumVal = ""

$PosturiExistente = StringTrimRight($DataItemRadio, 1)
GUICtrlSetData($ComboDeleteRadio, "Șterge postul de radio..."& "|" &$PosturiExistente,"Șterge postul de radio...")
EndFunc

Func _AddRadio()
$FormAddRadio = GUICreate("Adaugă post de radio", 403, 125, 438, 326, 0, 0)
$GroupAddRadio = GUICtrlCreateGroup("Adaugă post de radio", 0, 0, 401, 113)
$GroupAddRadioName = GUICtrlCreateGroup("Nume", 8, 22, 129, 48)
$NumePostRadio = GUICtrlCreateInput("Nume...", 16, 40, 113, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$GroupAddRadioStream = GUICtrlCreateGroup("Steam", 144, 22, 249, 48)
$NumeSteamRadio = GUICtrlCreateInput("Adresa...", 152, 40, 233, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ButtonAddRadioOK = GUICtrlCreateButton("OK", 88, 72, 75, 25)
GUICtrlSetOnEvent(-1, "MenuEvents")
$ButtonAddRadioRenunta = GUICtrlCreateButton("Renuță", 200, 72, 75, 25)
GUICtrlSetOnEvent(-1, "MenuEvents")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
EndFunc

Func _RegEnumValDataItem($sKeyName)
Local $sRegEnumVal, $sRegRead, $sRet
Do
     $iCountItem += 1
     Local $sRegEnumVal = RegEnumVal($sKeyName, $iCountItem)
$TrayItemRadio[$iCountItem] = _TrayCreateItem($sRegEnumVal, $TrayMenuPosturi)
_TrayItemSetIcon($TrayItemRadio[$iCountItem], "", 0)
GUICtrlSetOnEvent($TrayItemRadio[$iCountItem], "MenuEvents")
     If @error Then ExitLoop
Until $sRegEnumVal = ""
EndFunc


Func _RegEnumValData($sKeyName)
Local $iCount, $sRegEnumVal, $sRegRead, $sRet

Do
     $iCount += 1
     Local $sRegEnumVal = RegEnumVal($sKeyName, $iCount)
     Local $sRegRead = RegRead($sKeyName, $sRegEnumVal)
     $sRet &= $sRegEnumVal & " = " & $sRegRead & @CRLF
     If @error Then ExitLoop
Until $sRegEnumVal = ""

Return $sRet
EndFunc


Func _RegEnumValDataName($sKeyName)
Local $iCount, $sRegEnumVal,$sRet

Do
     $iCount += 1
     Local $sRegEnumVal = RegEnumVal($sKeyName, $iCount)

If RegEnumVal($sKeyName, $iCount + 1) Then
$sRet &= $sRegEnumVal & "|"
Else
$sRet &= $sRegEnumVal
EndIf

     If @error Then ExitLoop
Until $sRegEnumVal = ""

Return $sRet
EndFunc


Func _RegEnumValDataLink($sKeyName)
Local $iCount, $sRegEnumVal, $sRegRead, $sRet

Do
     $iCount += 1
     Local $sRegEnumVal = RegEnumVal($sKeyName, $iCount)
     Local $sRegRead = RegRead($sKeyName, $sRegEnumVal)

If RegEnumVal($sKeyName, $iCount + 1) Then
$sRet &= $sRegRead & "|"
Else
$sRet &= $sRegRead
EndIf

     If @error Then ExitLoop
Until $sRegEnumVal = ""

Return $sRet
EndFunc

Func SetDefaultMenuColors()
_SetMenuBkColor(0xFFFFFF)
_SetMenuIconBkColor(0xDBD8D8)
_SetMenuSelectBkColor(0xD2BDB6)
_SetMenuSelectRectColor(0x854240)
_SetMenuSelectTextColor(0x000000)
_SetMenuTextColor(0x000000)
EndFunc


Func SetRedMenuColors()
_SetMenuBkColor(0xAADDFF)
_SetMenuIconBkColor(0x5566BB)
_SetMenuSelectBkColor(0x70A0C0)
_SetMenuSelectRectColor(0x854240)
_SetMenuSelectTextColor(0x000000)
_SetMenuTextColor(0x000000)
EndFunc


Func SetGreenMenuColors()
_SetMenuBkColor(0xAAFFAA)
_SetMenuIconBkColor(0x66BB66)
_SetMenuSelectBkColor(0xBBCC88)
_SetMenuSelectRectColor(0x222277)
_SetMenuSelectTextColor(0x770000)
_SetMenuTextColor(0x000000)
EndFunc


Func SetBlueMenuColors()
_SetMenuBkColor(0xFFB8B8)
_SetMenuIconBkColor(0xBB8877)
_SetMenuSelectBkColor(0x662222)
_SetMenuSelectRectColor(0x4477AA)
_SetMenuSelectTextColor(0x66FFFF)
_SetMenuTextColor(0x000000)
EndFunc


Func SetBlueTrayColors()
_SetTrayBkColor(0xFFD8C0)
_SetTrayIconBkColor(0xEE8877)
_SetTrayIconBkGrdColor(0x703330)
_SetTraySelectBkColor(0x662222)
_SetTraySelectRectColor(0x4477AA)
_SetTraySelectTextColor(0x66FFFF)
_SetTrayTextColor(0x000000)
EndFunc


Func SetOLBlueColors()
_SetMenuBkColor(0xFFFFFF)
_SetMenuIconBkColor(0xFFEFE3)
_SetMenuIconBkGrdColor(0xE4AD87)
_SetMenuSelectBkColor(0xC2EEFF)
_SetMenuSelectRectColor(0x800000)
_SetMenuSelectTextColor(0x000000)
_SetMenuTextColor(0x000000)
EndFunc


Func SetOLSilverColors()
_SetMenuBkColor(0xF9F9F9)
_SetMenuIconBkColor(0xFDFDFD)
_SetMenuIconBkGrdColor(0xC0A0A0)
_SetMenuSelectBkColor(0xC2EEFF)
_SetMenuSelectRectColor(0x800000)
_SetMenuSelectTextColor(0x000000)
_SetMenuTextColor(0x000000)
EndFunc

Solved!

Edited by auemitpas

Share this post


Link to post
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
Sign in to follow this  
Followers 0