okay hier der ganze code:
Fenster.pb
Code: Alles auswählen
;
; PureBasic Visual Designer v3.92 build 1460
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Text_0
#Text_1
#Horer
#Text_3
#Text_4
#Text_5
#Image_1
#Nechste_Titel
#Text_7
#Cover
#Titel_Spielt
#RadioStart
#RadioStop
#Home
#Chat
#Button_5
#Text_9
#Volume
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Times New Roman", 28)
Global FontID2
FontID2 = LoadFont(2, "Times New Roman", 16)
;- Image Plugins
;- Image Globals
Global Image0
Global Image1
;- Catch Images
Image0 = CatchImage(0, ?Image0)
Image1 = CatchImage(1, ?Image1)
;- Images
DataSection
Image0:
IncludeBinary "img\mp3pro.ico"
Image1:
IncludeBinary "img\mp3pro.ico"
EndDataSection
Procedure Open_Window_0()
If OpenWindow(#Window_0, 202, 77, 600, 300, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar , "Schlossradio")
If CreateGadgetList(WindowID())
TextGadget(#Text_0, 70, 5, 445, 35, "Schlossradio www.komoro.de ")
SetGadgetFont(#Text_0, FontID1)
TextGadget(#Text_1, 20, 115, 90, 15, "Es werden Zurzeit")
TextGadget(#Horer, 110, 115, 20, 15, "0",#PB_Text_Center)
TextGadget(#Text_3, 133, 115, 100, 15, "Zuhörer Regestriert")
TextGadget(#Text_4, 20, 135, 125, 15, "Als nächstes wird gespielt:")
TextGadget(#Text_5, 65, 65, 285, 25, "Gesendet und Empfangen wird im")
SetGadgetFont(#Text_5, FontID2)
ImageGadget(#Image_1, 360, 50, 114, 62, Image0)
TextGadget(#Nechste_Titel, 150, 135, 440, 30, "")
TextGadget(#Text_7, 20, 170, 70, 15, "Gespielt Wird:")
ImageGadget(#Cover, 25, 195, 80, 80, Image1)
TextGadget(#Titel_Spielt, 90, 170, 220, 30, "")
ButtonGadget(#RadioStart, 245, 235, 75, 25, "Starten")
ButtonGadget(#RadioStop, 245, 260, 75, 25, "Stop")
ButtonGadget(#Home, 490, 220, 75, 25, "Strat Seite")
ButtonGadget(#Chat, 490, 245, 75, 25, "Chat/Forum")
ButtonGadget(#Button_5, 245, 210, 75, 25, "Audio Config")
TextGadget(#Text_9, 325, 170, 20, 15, "Vol")
TrackBarGadget(#Volume, 325, 185, 25, 110, 0, 255, #PB_TrackBar_Vertical)
EndIf
EndIf
EndProcedure
Exe_finder.pb
Code: Alles auswählen
Procedure.s GetExePath()
Prg.s = Space(#MAX_PATH)
GetModuleFileName_(GetModuleHandle_(0), @Prg, #MAX_PATH)
Prg = GetPathPart(Prg)
If (FindString(prg,"\PureBasic\Compilers\", 1))
Prg.s = Space(#MAX_PATH)
GetCurrentDirectory_(#MAX_PATH,@Prg)
EndIf
If Right(Prg, 1) <> "\" : Prg + "\" : EndIf
ProcedureReturn Prg
teste$ = Prg.s
EndProcedure
Lesen.pb
Code: Alles auswählen
URLDownloadToFile_(0, "http://www.komoro.de/radio/php1/playing.php", GetExePath() + "Text.txt", 0, 0)
If ReadFile(0, GetExePath() + "Text.txt")
;Debug "Datei geöffnet"
; Debug Eof(0)
While Eof(0) = 0
html$ = ReadString()
If FindString(html$, "Komoro beschallt soeben", 1)
Temp$ = RemoveString(html$, "Das Schlossradio - Komoro beschallt soeben ")
Zuhorer$ = RemoveString(Temp$, " Zuhörer !<br><br><p>Gesendet wird")
Debug Zuhorer$
;MessageRequester("Information","Im Schlossradio sind zurzeit " + Zuhorer$ + " Zuhörer.")
EndIf
If FindString(html$,"<td ><font size=" + Chr(34) + "3" + Chr(34) , 1)
Temp$ = RemoveString(html$, " <td ><font size="); + Chr(34) + "3" + Chr(34) + "color=" + Chr(34) + "#003366" + Chr(34) + "><small>")
Temp$ = RemoveString(Temp$, Chr(34) + "3" + Chr(34)); + "color=" + Chr(34) + "#003366" + Chr(34) + "><small>")
Temp$ = RemoveString(Temp$, "color=" + Chr(34) + "#003366" + Chr(34) + "><small>")
Temp$ = RemoveString(Temp$, "</small></font></td>")
Debug Temp$
If Titel$ = ""
Titel$ = Temp$
EndIf
;MessageRequester("Information","Im Schlossradio ist gerade "+ Titel$ + "zu hören.")
EndIf
If FindString(html$," " , 1)
Temp$ = RemoveString(html$, " ")
Temp$ = RemoveString(Temp$, "</b></font></td></tr></marquee>")
Debug Temp$
Nechter$ = Temp$
EndIf
If FindString(html$,"img id=" + Chr(34) + "Picture1", 1)
Posi = FindString(html$,"http://www.komoro.de" , 1)
Temp$ = Mid(html$, Posi, Len(html$))
Temp$ = RemoveString(Temp$, Chr(34) + " alt=")
Temp$ = RemoveString(Temp$, Chr(34) + "CD Kaufen!")
Temp$ = RemoveString(Temp$, Chr(34) + " border=0></a>")
Debug Temp$
URLDownloadToFile_(0, Temp$, GetExePath() + "Cover.jpg", 0, 0)
EndIf
Wend
CallDebugger
CloseFile(0)
If a <> 1
If Zuhorer$ = ""
SetGadgetText(#Horer, "0")
Else
SetGadgetText(#Horer, Zuhorer$)
EndIf
SetGadgetText(#Nechste_Titel, Nechter$)
SetGadgetText(#Titel_Spielt, Titel$)
Zuhorer$ = "":Nechter$ = "":Titel$ = ""
a = 1
EndIf
Else
MessageRequester("Information","Konnte Datei nicht öffnen!")
EndIf
Examples.pb
Code: Alles auswählen
; PureBasic Visual Designer v3.92 build 1460
IncludeFile "Fenster.pb"
IncludeFile "Exe_finder.pb"
Open_Window_0()
IncludeFile "Lesen.pb"
Repeat ; Start of the event loop
Event = WindowEvent() ; This line waits until an event is received from Windows
Delay(1)
Time + 1
WindowID = EventWindowID() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadgetID() ; Is it a gadget event?
EventType = EventType() ; The event type
If Time >= 9000
IncludeFile "Lesen.pb"
If Zuhorer$ = ""
TextGadget(#Horer, 110, 115, 20, 15, "0", #PB_Text_Center)
Else
TextGadget(#Horer, 110, 115, 20, 15, Zuhorer$,#PB_Text_Center)
EndIf
TextGadget(#Nechste_Titel, 150, 135, 440, 30, Nechter$,#PB_Text_Center)
TextGadget(#Titel_Spielt, 90, 170, 220, 30, Titel$,#PB_Text_Center)
WindowEvent()
Zuhorer$ = "":Nechter$ = "":Titel$ = ""
Time = 0
EndIf
;You can place code here, and use the result as parameters for the procedures
If Event = #PB_EventGadget
If GadgetID = #Image_1
ElseIf GadgetID = #Cover
ElseIf GadgetID = #RadioStart
ElseIf GadgetID = #RadioStop
ElseIf GadgetID = #Home
ElseIf GadgetID = #Chat
ElseIf GadgetID = #Button_5
ElseIf GadgetID = #Volume
EndIf
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
;