1. Artikel
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forum
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. Paules-PC-Forum.de
  2. Forum
  3. Programmierung
  4. Sonstige Programmiersprachen

PureBasic: Problem mit Sourcecode.

  • Primarom
  • 13. Februar 2011 um 13:40
  • Primarom
    Erfolgreich angemeldet
    Beiträge
    1
    • 13. Februar 2011 um 13:40
    • #1

    Hallo, bin neu hier und frage gleich mal ein paar Fragen, hoffe Ihr kennt euch mit Pure Basic aus bzw habt vielleicht damit schon mal gearbeitet?

    Folgendes Problem, seit ich das Menu meiner Software umgestellt habe funktionieren die Play, Stop und Pause Buttons nicht mehr wieso auch selber im Menu.

    Kann keinen Fehler selber feststellen, obwohl man ja manchmal den Wald voller Bäumen nicht sieht.

    Code
    #WindowWidth = 450
    #WindowHeight = 68
    If InitMovie() = 0
      MessageRequester("Error", "Can't initialize movie playback !", 0)
      End
    EndIf
    If OpenWindow(0, 100, 100, 450, 68, "DVIX Plus Player 1.14.6a", #PB_Window_Invisible | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget)
      If CreateMenu(0, WindowID(0))
        MenuTitle("Medien")
        MenuItem(0, "Datei öffnen...")
          MenuBar()
          MenuItem(1, "Beenden")
    
        MenuTitle("Wiedergabe")
          MenuItem(2, "Play")
          MenuItem(3, "Stop")
          MenuItem(4, "Pause")
    
    
          MenuTitle("Audio")
    
          OpenSubMenu("Lautstärke")
            MenuItem(6, "100 %")
            MenuItem(7, "50 %")
            MenuItem(8, "Mute")
          CloseSubMenu()
    
          OpenSubMenu("Balance")
            MenuItem( 9, "Middle")
            MenuItem(10, "Left")
            MenuItem(11, "Right")
            CloseSubMenu()
    
            MenuTitle("Video")
    
          OpenSubMenu("Zoomen")
            MenuItem(13, "50 %")
            MenuItem(14, "100 %")
            MenuItem(15, "200 %")
          CloseSubMenu()
    
        MenuTitle("Hilfe") 
        MenuItem(12, "Hilfe")
        MenuBar()
        MenuItem(16, "Nach Updates suchen...")
        MenuItem(17, "Über...")
      EndIf
      If CreateToolBar(0, WindowID(0))
        ToolBarImageButton(0, LoadImage(0, "Icons\Load.ico"))
        ToolBarSeparator()
        ToolBarImageButton(3, LoadImage(0, "Icons\Stop.ico"))
        ToolBarImageButton(2, LoadImage(0, "Icons\Play.ico"))
        ToolBarImageButton(4, LoadImage(0, "Icons\Pause.ico"))
        ToolBarSeparator()
        ToolBarImageButton(12, LoadImage(0, "Icons\About.ico"))
        ToolBarSeparator()
        ToolBarImageButton(13, LoadImage(0, "Icons\Face.ico"))
        ToolBarImageButton(14, LoadImage(0, "Icons\Google.ico"))
        ToolBarImageButton(15, LoadImage(0, "Icons\Inlink.ico"))
    
      EndIf
    
      If CreateStatusBar(0, WindowID(0))
        AddStatusBarField(6000) ; Excessive value of 6000 pixels, to have a field which take all the window width !
        StatusBarText(0, 0, "Welcome !", 0)
      EndIf
    
      HideWindow(0, 0)  ; Show the window once all toolbar/menus has been created...
    
      Volume = 100
    
      Repeat
    
        Select WindowEvent()
    
          Case #PB_Event_Menu
    
            Select EventMenu()
    
              Case 0 ; Load
                MovieName$ = OpenFileRequester("Datei öffnen", "", "Movie/Audio files|*.avi;*.mpg;*.mp4;*.mkv|*.asf;*.mp3;*.wav|All Files|*.*", 0)
                If MovieName$
                  If LoadMovie(0, MovieName$)
                    MovieLoaded = 1 
                    MovieState  = 0
    
                    If MovieHeight(0) > 0  ; Not an audio only file..
                      ResizeWindow(0, #PB_Ignore, #PB_Ignore, MovieWidth(0), MovieHeight(0)+70)
                    Else
                      ResizeWindow(0, #PB_Ignore, #PB_Ignore, #WindowWidth, #WindowHeight)
                    EndIf
    
                    StatusBarText(0, 0, "Movie '"+MovieName$+"' loaded", 0)
                  Else
                    StatusBarText(0, 0, "Can't load the movie '"+MovieName$+"'", 0)
                  EndIf
                EndIf
    
    
              Case 1 ; Beenden
                End
    
              ; ---------------- Movie controls -------------------
    
              Case 2 ; Play
    
                If MovieLoaded
                  If MovieState = 2
                    ResumeMovie(0)
                  Else
                    PlayMovie(0, WindowID(0))
                  EndIf
    
                  StatusBarText(0, 0, "Läuft...", 0)
                  MovieState = 2  ; Läuft
                EndIf
    
              Case 3 ; Stop
                If MovieLoaded And MovieState = 1
                  StopMovie(0)
                  MovieState = 3 ; Stopped
                  StatusBarText(0, 0, "Movie stopped.", 0)
               EndIf
    
              Case 4 ; Pause
                If MovieLoaded And MovieState = 1
                  PauseMovie(0) 
                  MovieState = 4  ; Paused
                  StatusBarText(0, 0, "Movie paused.", 0)
               EndIf
    
              ; ---------------- Volume -------------------
    
              Case 6 ; Volume 100%
                Volume = 100
    
              Case 7 ; Volume 50%
                Volume = 50
    
              Case 8 ; Volume 100%
                Volume = 0
    
              ; ---------------- Balance -------------------
    
              Case 9  ; Balance middle
                Balance = 0
    
              Case 10 ; Balance left
                Balance = -100
    
              Case 11 ; Balance right
                Balance = 100
    
              ; ---------------- Size -------------------
              Case 13  ; Size 50%
                If MovieLoaded 
                  MovieWidth  = MovieWidth(0)/2
                  MovieHeight = MovieHeight(0)/2
                EndIf
    
              Case 14 ; Size 100%
                If MovieLoaded 
                  MovieWidth  = MovieWidth(0)
                  MovieHeight = MovieHeight(0)
                EndIf
    
              Case 15 ; Size 200%
                If MovieLoaded 
                  MovieWidth  = MovieWidth(0)*2
                  MovieHeight = MovieHeight(0)*2
                EndIf
    
              ; ---------------- Misc -------------------
    
              Case 12 ; About
                MessageRequester("Info", "PureBasic Movie Player"+Chr(10)+Chr(10)+"[url=http://www.purebasic.com]PureBasic : Native compiler, easy & optimized BASIC programming language[/url]")
          EndSelect
    
            If MovieLoaded
              If CurrentWidth <> MovieWidth Or CurrentHeight <> MovieHeight
                ResizeWindow(0, #PB_Ignore, #PB_Ignore, MovieWidth+20, 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(0), WindowHeight(0)-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, "Movie Paused.", 0)
                Case 0
                  StatusBarText(0, 0, "Movie Stopped.", 0)
                Default
                  StatusBarText(0, 0, "Läuft :"+Str(MovieStatus(0)), 0)
    
              EndSelect
    
              PreviousMovieStatus = MovieStatus(0)
            EndIf
    
        EndSelect
    
      ForEver    
    EndIf
    End
    Alles anzeigen




    Vielleicht könnte Ihr mir sagen , was falsch ist bzw der Fehler.

    Vielen Dank schon mal,

    mfg
    Jens

  • AxT
    Premium-Mitglied
    Reaktionen
    2.978
    Beiträge
    33.384
    • 6. Juni 2011 um 17:33
    • #2

    Ist zwar schon alt, aber trotzdem:
    Du hast dich nur mit deiner Variablen MovieState vertan.
    Hier der korrigierte Code:

    Code
    #WindowWidth = 450
    #WindowHeight = 68
    If InitMovie() = 0
      MessageRequester("Error", "Can't initialize movie playback !", 0)
      End
    EndIf
    If OpenWindow(0, 100, 100, 450, 68, "DVIX Plus Player 1.14.6a", #PB_Window_Invisible | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget)
      If CreateMenu(0, WindowID(0))
        MenuTitle("Medien")
        MenuItem(0, "Datei öffnen...")
          MenuBar()
          MenuItem(1, "Beenden")
    
        MenuTitle("Wiedergabe")
          MenuItem(2, "Play")
          MenuItem(3, "Stop")
          MenuItem(4, "Pause")
    
    
          MenuTitle("Audio")
    
          OpenSubMenu("Lautstärke")
            MenuItem(6, "100 %")
            MenuItem(7, "50 %")
            MenuItem(8, "Mute")
          CloseSubMenu()
    
          OpenSubMenu("Balance")
            MenuItem( 9, "Middle")
            MenuItem(10, "Left")
            MenuItem(11, "Right")
            CloseSubMenu()
    
            MenuTitle("Video")
    
          OpenSubMenu("Zoomen")
            MenuItem(13, "50 %")
            MenuItem(14, "100 %")
            MenuItem(15, "200 %")
          CloseSubMenu()
    
        MenuTitle("Hilfe") 
        MenuItem(12, "Hilfe")
        MenuBar()
        MenuItem(16, "Nach Updates suchen...")
        MenuItem(17, "Über...")
      EndIf
      If CreateToolBar(0, WindowID(0))
        ToolBarImageButton(0, LoadImage(0, "Icons\Load.ico"))
        ToolBarSeparator()
        ToolBarImageButton(3, LoadImage(0, "Icons\Stop.ico"))
        ToolBarImageButton(2, LoadImage(0, "Icons\Play.ico"))
        ToolBarImageButton(4, LoadImage(0, "Icons\Pause.ico"))
        ToolBarSeparator()
        ToolBarImageButton(12, LoadImage(0, "Icons\About.ico"))
        ToolBarSeparator()
        ToolBarImageButton(13, LoadImage(0, "Icons\Face.ico"))
        ToolBarImageButton(14, LoadImage(0, "Icons\Google.ico"))
        ToolBarImageButton(15, LoadImage(0, "Icons\Inlink.ico"))
    
      EndIf
    
      If CreateStatusBar(0, WindowID(0))
        AddStatusBarField(6000) ; Excessive value of 6000 pixels, to have a field which take all the window width !
        StatusBarText(0, 0, "Welcome !", 0)
      EndIf
    
      HideWindow(0, 0)  ; Show the window once all toolbar/menus has been created...
    
      Volume = 100
    
      Repeat
    
        Select WindowEvent()
    
          Case #PB_Event_Menu
    
            Select EventMenu()
    
              Case 0 ; Load
                MovieName$ = OpenFileRequester("Datei öffnen", "", "Movie/Audio files|*.avi;*.mpg;*.mp4;*.mkv|*.asf;*.mp3;*.wav|All Files|*.*", 0)
                If MovieName$
                  If LoadMovie(0, MovieName$)
                    MovieLoaded = 1 
                    MovieState  = 0
    
                    If MovieHeight(0) > 0  ; Not an audio only file..
                      ResizeWindow(0, #PB_Ignore, #PB_Ignore, MovieWidth(0), MovieHeight(0)+70)
                    Else
                      ResizeWindow(0, #PB_Ignore, #PB_Ignore, #WindowWidth, #WindowHeight)
                    EndIf
    
                    StatusBarText(0, 0, "Movie '"+MovieName$+"' loaded", 0)
                  Else
                    StatusBarText(0, 0, "Can't load the movie '"+MovieName$+"'", 0)
                  EndIf
                EndIf
    
    
              Case 1 ; Beenden
                End
    
              ; ---------------- Movie controls -------------------
    
              Case 2 ; Play
    
                If MovieLoaded
                  If MovieState = 2
                    ResumeMovie(0)
                  Else
                    PlayMovie(0, WindowID(0))
                  EndIf
    
                  StatusBarText(0, 0, "Läuft...", 0)
                  MovieState = 1  ; Läuft
                EndIf
    
              Case 3 ; Stop
                If MovieLoaded And MovieState = 1
                  StopMovie(0)
                  MovieState = 3 ; Stopped
                  StatusBarText(0, 0, "Movie stopped.", 0)
               EndIf
    
              Case 4 ; Pause
                If MovieLoaded And MovieState = 1
                  PauseMovie(0) 
                  MovieState = 2  ; Paused
                  StatusBarText(0, 0, "Movie paused.", 0)
               EndIf
    
              ; ---------------- Volume -------------------
    
              Case 6 ; Volume 100%
                Volume = 100
    
              Case 7 ; Volume 50%
                Volume = 50
    
              Case 8 ; Volume 100%
                Volume = 0
    
              ; ---------------- Balance -------------------
    
              Case 9  ; Balance middle
                Balance = 0
    
              Case 10 ; Balance left
                Balance = -100
    
              Case 11 ; Balance right
                Balance = 100
    
              ; ---------------- Size -------------------
              Case 13  ; Size 50%
                If MovieLoaded 
                  MovieWidth  = MovieWidth(0)/2
                  MovieHeight = MovieHeight(0)/2
                EndIf
    
              Case 14 ; Size 100%
                If MovieLoaded 
                  MovieWidth  = MovieWidth(0)
                  MovieHeight = MovieHeight(0)
                EndIf
    
              Case 15 ; Size 200%
                If MovieLoaded 
                  MovieWidth  = MovieWidth(0)*2
                  MovieHeight = MovieHeight(0)*2
                EndIf
    
              ; ---------------- Misc -------------------
    
              Case 12 ; About
                MessageRequester("Info", "PureBasic Movie Player"+Chr(10)+Chr(10)+"PureBasic : Native compiler, easy & optimized BASIC programming language")
          EndSelect
    
            If MovieLoaded
              If CurrentWidth <> MovieWidth Or CurrentHeight <> MovieHeight
                ResizeWindow(0, #PB_Ignore, #PB_Ignore, MovieWidth+20, 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(0), WindowHeight(0)-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, "Movie Paused.", 0)
                Case 0
                  StatusBarText(0, 0, "Movie Stopped.", 0)
                Default
                  StatusBarText(0, 0, "Läuft :"+Str(MovieStatus(0)), 0)
    
              EndSelect
    
              PreviousMovieStatus = MovieStatus(0)
            EndIf
    
        EndSelect
    
      ForEver    
    EndIf
    End
    Alles anzeigen

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!

Benutzerkonto erstellen Anmelden

Windows 11

  1. Datenschutzerklärung
  2. Impressum
Community-Software: WoltLab Suite™