Start New Discussion within our Software Development Community

Hey guys, I have this program that I'm making and there's a video playing and when the video is at a certain time it changes the desktop background. It all works but there's one feature I'm missing and it's that I want my desktop background to be on the Fill setting. I have a Windows 8 computer and I'm using Visual Studio 2012, can anybody help modify my code a little?:

Public Class Video
    Public Background1Location As String = "C:\Users\David\Desktop\HEADBANNER_2.gif"
    Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
    'Declare two constant
    Private Const SETDESKWALLPAPER = 20
    Private Const UPDATEINIFILE = &H1

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        ' Cast the interface returned by player.Ctlcontrols to an IWMPControls3 interface
        ' so that you can use the currentPositionTimecode property.
        Dim controls As WMPLib.IWMPControls3 = AxWindowsMediaPlayer1.Ctlcontrols

        ' Seek to a frame using SMPTE time code.
        If controls.currentPositionString = "00:28" Then
            SystemParametersInfo(SETDESKWALLPAPER, 0, Background1Location, UPDATEINIFILE)
        End If
    End Sub

    Private Sub AxWindowsMediaPlayer1_PlayStateChange(sender As Object, e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
        If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
            Application.Exit()
        End If
    End Sub
End Class

Thanks.

This article has been dead for over six months. Start a new discussion instead.