I'm having a little trouble with my code, when I initialize the language procedure it says the #Window object is not initialised...
I will post my code but I would like you to know that it is Copyright © 2007 Joseph Kemp, All Rights Reserved so I would like it if you don't steal it because it is my entire program

Code: Select all
UsePNGImageDecoder()
;- Window Constants
Enumeration 1
#Window_main
#Window_LangSelect
#Window_about
EndEnumeration
#WindowIndex=#PB_Compiler_EnumerationValue
;- Gadget Constants
Enumeration 1
; --- Main ---
#Gadget_Main_ComboBox
#Gadget_Main_B_OK
; --- About ---
#Gadget_About_Msg
#Gadget_About_Banner
#Gadget_about_OK
EndEnumeration
#GadgetIndex=#PB_Compiler_EnumerationValue
;- Image Constants
Enumeration 1
#Image_Logo
#Image_Load
#Image_Play
#Image_Stop
#Image_Pause
#Image_CD
#Image_Previous
#Image_Next
#Image_Language
#Image_About
#Image_Web
#Image_Register
#Image_Repeat
#Image_Full
EndEnumeration
Global ProgDir$, LangINI$
#WindowWidth = 400
#WindowHeight = 400
#LangDir = "languages"
#LangExt = "*.lng"
ProgDir$ = GetPathPart(ProgramFilename()) ;{ Program Directory
If ProgDir$ = #PB_Compiler_Home+"Compilers\" : ProgDir$ = GetCurrentDirectory() : EndIf
LangINI$ = ProgDir$ + #LangDir + "\English.lng"
LoadLanguage(LangINI$)
InitAudioCD()
; ===== Procedures =====
Procedure.s GetLanguage()
If OpenWindow(#Window_LangSelect, 0, 0, 200, 60, "Language", #PB_Window_SystemMenu | #PB_Window_ScreenCentered, WindowID(#Window_main)) And CreateGadgetList(WindowID(0))
If CreateGadgetList(WindowID(#Window_LangSelect))
ComboBoxGadget(#Gadget_Main_ComboBox, 10, 10, 180, 100)
ButtonGadget(#Gadget_Main_B_OK,75,35,50,20,"OK")
If ExamineDirectory(0, ProgDir$ + #LangDir, #LangExt) ;{ Populate the combo.
While NextDirectoryEntry(0)
If DirectoryEntryType(0)
AddGadgetItem(1, -1, DirectoryEntryName(0))
EndIf
Wend
FinishDirectory(0)
EndIf ;}
SetGadgetState(1, 0) ; set (beginning with 0) the third item as active one
quitWindow = #False
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
If EventWindow() = #Window_LangSelect
quitWindow = #True
EndIf
Case #PB_Event_Gadget
If EventGadget() = #Gadget_Main_B_OK
SelectLang$ = GetGadgetText(1)
quitWindow = #True
EndIf
EndSelect
Until quitWindow
CloseWindow(#Window_LangSelect)
EndIf
EndIf
ProcedureReturn ProgDir$ + #LangDir + "\" + SelectLang$
EndProcedure
; ======================
If InitMovie() = 0
MessageRequester(language(#Lang_Request_reError), "Can't initialize movie playback !", 0)
End
EndIf
max=#PB_Window_MinimizeGadget
If OpenWindow(#Window_main, 100, 100, #WindowWidth, #WindowHeight, "Mindtrick Gaming Media Player --- v1.0", #PB_Window_Invisible | #PB_Window_MinimizeGadget|max)
;----------------Shortcuts-------------
AddKeyboardShortcut(#Window_main, #PB_Shortcut_Control | #PB_Shortcut_O, 0)
AddKeyboardShortcut(#Window_main, #PB_Shortcut_Escape, 1)
If CreateStatusBar(0, WindowID(#Window_main))
AddStatusBarField(6000)
StatusBarText(0, 0, "http://www.mindtrick-forefront.uni.cc/", 0)
EndIf
HideWindow(#Window_main, 0)
Volume = 50
Repeat
Select WindowEvent()
Case #PB_Event_Menu
Select EventMenu()
Case 0 ; Load
MovieName$ = OpenFileRequester(language(#Lang_Request_reLoad), "", language(#Lang_Request_reFiles)+"|*.avi;*.mpg;*.asf;*.mp3;*.wav;*.wmv|All Files|*.*", 0)
If MovieName$
If LoadMovie(0, MovieName$)
MovieLoaded = 1
MovieState = 0
If MovieHeight(0) > 0 ; Not an audio only file..
ResizeWindow(#Window_main, #PB_Ignore, #PB_Ignore, MovieWidth(0)+20, MovieHeight(0)+70)
Else
ResizeWindow(#Window_main, #PB_Ignore, #PB_Ignore, #WindowWidth, #WindowHeight)
EndIf
StatusBarText(0, 0, language(#Lang_Status_sbMedia)+MovieName$+language(#Lang_Status_sbLoaded), 0)
Else
StatusBarText(0, 0, language(#Lang_Status_sbNoLoad)+MovieName$+"'", 0)
EndIf
EndIf
Case 20 ; Language
LangINI$ = GetLanguage()
LoadLanguage(LangINI$)
Case 12 ; My Custom About Box!!
AboutWindow()
EndSelect
If MovieLoaded
If CurrentWidth <> MovieWidth Or CurrentHeight <> MovieHeight
ResizeWindow(#Window_main, #PB_Ignore, #PB_Ignore, MovieWidth+70, MovieHeight+100) ; Movie will be resized in the #PB_WindowSizeEvent
CurrentWidth = MovieWidth
CurrentHeight = MovieHeight
EndIf
If CurrentVolume <> Volume Or CurrentBalance <> Balance ; We need to update the audio stuff
MovieAudio(0, Volume, Balance)
CurrentVolume = Volume
CurrentBalance = Balance
EndIf
EndIf
Case #PB_Event_CloseWindow
End
Case #PB_Event_SizeWindow
If IsMovie(0)
ResizeMovie(0, 0, 27, WindowWidth(#Window_main), WindowHeight(#Window_main)-70)
EndIf
Case 0
Delay(20)
If MovieLoaded And MovieStatus(0) <> PreviousMovieStatus ; To prevent flickering on the StatusBar
Select MovieStatus(0)
Case -1
StatusBarText(0, 0, language(#Lang_Status_sbPaused), 0)
Case 0
StatusBarText(0, 0, language(#Lang_Status_sbStopped), 0)
Default
StatusBarText(0, 0, language(#Lang_Status_sbPlaying)+Str(MovieStatus(0))+"/"+Str(MovieLength(0)), 0)
EndSelect
PreviousMovieStatus = MovieStatus(0)
EndIf
EndSelect
ForEver
EndIf
EDITED