Question WMP on second form won't play in fullscreen

ud2008

Well-known member
Joined
Jul 5, 2010
Messages
148
Programming Experience
Beginner
I have this program, created with vb2010, to play video on the main screen and on a second screen. This works, but I don't get the second screen WMP to play at fullscreen, it just stays at normal size.
The second is not a pre-designed form, it's created when I click on a button, and then the WMP is added to the form as control.

Here is the code I have:
VB.NET:
Dim musiclocation As New ArrayList
    Dim scform As New Form
    Dim screen As Screen
    Dim mediaplayer As New AxWMPLib.AxWindowsMediaPlayer

Private Sub SwitchButton1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles SwitchButton1.ValueChanged
        If SwitchButton1.Value = True Then
            scform.Controls.Add(mediaplayer)
            mediaplayer.Dock = DockStyle.Fill
            screen = screen.AllScreens(1)
            scform.ShowInTaskbar = True
            scform.StartPosition = FormStartPosition.Manual
            scform.Location = screen.Bounds.Location + New Point(100, 100)
            scform.WindowState = FormWindowState.Maximized
            scform.FormBorderStyle = Windows.Forms.FormBorderStyle.None
            scform.Show()
            mediaplayer.uiMode = "none"
            mediaplayer.Dock = DockStyle.Fill
            'mediaplayer.fullScreen = True
            If ListBox1.Items.Count > 0 Then
                PlayButton.Enabled = True
                ListBox1.Enabled = True
            ElseIf ListBox1.Items.Count = 0 Then
                ListBox1.Enabled = False
                PlayButton.Enabled = False
            End If
        Else
            scform.Hide()
            mediaplayer.Ctlcontrols.stop()
            Player.Ctlcontrols.stop()
            PlayButton.Enabled = False
            PauseButton.Enabled = False
            StopButton.Enabled = False
            ListBox1.Enabled = False
            If CheckBox1.Checked = True Then
                CheckBox1.Checked = False
                CheckBox1.Enabled = False
            End If
        End If
    End Sub

Private Sub PlayButton_Click(sender As System.Object, e As System.EventArgs) Handles PlayButton.Click
        Try
            If ListBox1.SelectedItem = Nothing Then
                MsgBox("Select media to play")
            Else
                CheckBox1.Enabled = True
                mediaplayer.Ctlcontrols.play()
                Player.Ctlcontrols.play()
                Timer1.Start()
                Player.settings.volume = Player.settings.mute
                StopButton.Enabled = True
                PauseButton.Enabled = True
                PlayButton.Enabled = False
                Me.Select()
            End If
            If mediaplayer.playState = WMPLib.WMPPlayState.wmppsPlaying Then
                mediaplayer.fullScreen = True
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

Any help would be great.

Thanks.
 
I solved it, it wasn't the screen that went black, but the the thumbnail in the startbar (on windows 7).

This question can be marked as solved.
 
Back
Top