Hi ich habe mal ein Programm geschrieben, in dem ich will das man während es läuft, das Hintergrundbild der GUI ändern kann und das es nach einem Programmneustart trotzdem wieder das ausgewählte erscheint. Das mit .Ini habe ich leider net selber geschafft. Hier der wichtige Teil des Scripts:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Icon.ico
#AutoIt3Wrapper_outfile=..\Desktop\BlackEyes StreamPlayer\BlackEyes StreamPlayer.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Fileversion=1.3.1.12
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <StructureConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <Security.au3>
#include <Memory.au3>
#include <UDFGlobalID.au3>
#include <GuiStatusBar.au3>
#include <GUIEdit.au3>
#include-once
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <GUIEdit.au3>
#include <GuiToolbar.au3>
#include <inet.au3>
#include <array.au3>
#include <ie.au3>
AdlibRegister("CheckMouse")
[/autoit] [autoit][/autoit] [autoit]$oWMP = ObjCreate("WMPLayer.ocx")
$GUI = GUICreate("BlackEyes Stream Player", 498, 357, 238, 172)
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\Styles\BlackEyes.jpg", 0, 0, 497, 353, BitOR($WS_GROUP,$WS_CLIPSIBLINGS))
$HauptMenu = GUICtrlCreateMenu("Datei")
$HMenuE = GUICtrlCreateMenuItem("Beenden",$HauptMenu)
$SMenu = GUICtrlCreateMenu("Stream URLs")
$SMenu1 = GUICtrlCreateMenuItem("TechnoBase.FM",$SMenu)
$SMenu2 = GUICtrlCreateMenuItem("Top100Station",$SMenu)
$SMenu3 = GUICtrlCreateMenuItem("Planet Radio",$SMenu)
$SMenu4 = GUICtrlCreateMenuItem("YouFM",$SMenu)
$SMenu5 = GUICtrlCreateMenuItem("BigFM",$SMenu)
$SMenu6 = GUICtrlCreateMenuItem("Rautemusik.fm Main",$SMenu)
$SMenu7 = GUICtrlCreateMenuItem("1Live",$SMenu)
$StyleM = GUICtrlCreateMenu("Styles")
$Style1 = GUICtrlCreateMenuItem("BlackEyes",$StyleM)
$Style2 = GUICtrlCreateMenuItem("Standard",$StyleM)
$Menu = GUICtrlCreateMenu("Hilfe")
$MenuE = GUICtrlCreateMenuItem("About",$Menu)
$Combo1 = GUICtrlCreateCombo("Bitte auswählen", 144, 112, 209, 25)
GUICtrlSetData(-1,"TechnoBase.FM|Top100Station|Planet Radio|YouFM|BigFM|Rautemusik.fm Main|1Live","Bitte auswählen")
$Label1 = GUICtrlCreateLabel("Radio Streams", 144, 88, 94, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Button1 = GUICtrlCreateButton("Play", 24, 304, 193, 33, $WS_GROUP)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Stop", 280, 304, 193, 33, $WS_GROUP)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetState($Button2, $GUI_DISABLE)
$Progress1 = GUICtrlCreateProgress(8, 30, 33, 265, $PBS_VERTICAL)
GUICtrlSetBkColor($Progress1,0x1000)
$Volume = GUICtrlCreateSlider(448, 30, 33, 265, BitOR($TBS_AUTOTICKS,$TBS_VERT))
GUICtrlSetBkColor($Volume,000000)
GUICtrlSetData(-1, $oWMP.settings.volume())
GUICtrlSetState($Volume, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
$oWMP.settings.volume = 100 - GUICtrlRead($Volume)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $HMenuE
Exit
Case $SMenu1
MsgBox(0,"TechnoBase.FM","http://listen.technobase.fm/tunein-dsl-asx")
Case $SMenu2
MsgBox(0,"Top100Station","http://www.top100station.de/switch/r3472.asx")
Case $SMenu3
MsgBox(0,"Planet Radio","http://lsd.newmedia.nacamar.net/bb/redirect.lsc?stream=planetradio$livestream.mp3&content=live&media=mp3")
Case $SMenu4
MsgBox(0,"YouFM","http://metafiles.gl-systemhaus.de/hr/youfm_1.asx")
Case $SMenu5
MsgBox(0,"BigFM","http://217.151.152.245/bigfm-mp3-96")
Case $SMenu6
MsgBox(0,"Rautemusik.fm Main","http://main-high.rautemusik.fm/listen.asx")
Case $SMenu7
MsgBox(0,"1Live","http://www.wdr.de/wdrlive/media/einslive.asx")
Case $MenuE
MsgBox(0,"About BlackEyes StreamPlayer","BlackEyes StreamPlayer Version 1.3.1.12")
Case $Button1
$readcombo1 = GUICtrlRead($Combo1)
$oWMP.controls.play()
GUICtrlSetState($Volume, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
Switch $Button1
Case $readcombo1 = "TechnoBase.FM"
$oWMP.URL = 'http://listen.technobase.fm/tunein-dsl-asx'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "Top100Station"
$oWMP.URL = 'http://www.top100station.de/switch/r3472.asx'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "Planet Radio"
$oWMP.URL = 'http://lsd.newmedia.nacamar.net/bb/redirect.lsc?stream=planetradio$livestream.mp3&content=live&media=mp3'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "YouFM"
$oWMP.URL = 'http://metafiles.gl-systemhaus.de/hr/youfm_1.asx'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "BigFM"
$oWMP.URL = 'http://217.151.152.245/bigfm-mp3-96'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "Rautemusik.fm Main"
$oWMP.URL = 'http://main-high.rautemusik.fm/listen.asx'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "1Live"
$oWMP.URL = 'http://www.wdr.de/wdrlive/media/einslive.asx'
GUICtrlSetData($Progress1, 100)
Sleep(2000)
GUICtrlSetData($Progress1, 0)
Case $readcombo1 = "Bitte auswählen"
MsgBox(0,"ERROR","Kein Sender ausgewählt!")
EndSwitch
Case $Button2
$oWMP.controls.stop()
GUICtrlSetState($Volume, $GUI_DISABLE)
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Combo1, $GUI_ENABLE)
GUICtrlSetData($Progress1, 0)
EndSwitch
WEnd
Func CheckMouse()
Local Static $mouseout=0
$aMpos = MouseGetPos()
$aWpos = WinGetPos("BlackEyes Stream Player")
If $aMpos[0] > $aWpos[0] And $aMpos[0] < $aWpos[0] + $aWpos[2] And $aMpos[1] > $aWpos[1] And $aMpos[1] < $aWpos[1] + $aWpos[3] Then
If $mouseout = 1 Then
For $i=30 to 255 Step 30
WinSetTrans("BlackEyes Stream Player", "", $i)
sleep(50)
Next
WinSetTrans("BlackEyes Stream Player", "", 255)
$mouseout=0
EndIf
Else
If $mouseout=0 Then
For $i=255 to 30 Step -30
WinSetTrans("BlackEyes Stream Player", "", $i)
sleep(50)
Next
$mouseout=1
EndIf
EndIf
EndFunc
Am besten soll es sich ändern wenn man im Menü Styles auf den jeweiligen Style drückt.