Did you ever want to have a relaxing movie playing when your computer is sitting idle? Below is a program that will start maximized.
To run this code you will need:
1. Form called frmPlayer
2. WindowsMediaPlayer called WMP1
3. CommonDialog called CD1
4. Command button called cmdOpen
5. Command button called cmdPlay
6. ChkBox called chkMax set to Checked
7. ChkBox called chkRepeat set to Checked
8. Movie that you wish to default display copied to the Application Directory. I used "winsat.wmv", which I found in the \Windows\Performance" directory.
The Media Player options can only be set once the player has been started, hence the loop to check its state. Using the "Esc" key will return the program to the normal size.
J.A. Coutts
Code:
Option Explicit
Private Sub chkMax_Click()
End Sub
Private Sub chkRepeat_Click()
End Sub
Private Sub cmdOpen_Click()
CD1.ShowOpen
frmPlayer.Caption = CD1.FileName
End Sub
Private Sub cmdPlay_Click()
WMP1.URL = frmPlayer.Caption
Do Until WMP1.playState <> 9
DoEvents
Loop
WMP1.settings.volume = 10
WMP1.fullScreen = chkMax.Value
WMP1.settings.setMode "Loop", chkRepeat.Value
End Sub
Private Sub Form_Initialize()
frmPlayer.Caption = App.Path & "\winsat.wmv"
End Sub
Private Sub Form_Load()
ChDir (App.Path)
End Sub
Private Sub Form_Resize()
Call cmdPlay_Click
End Sub
1. Form called frmPlayer
2. WindowsMediaPlayer called WMP1
3. CommonDialog called CD1
4. Command button called cmdOpen
5. Command button called cmdPlay
6. ChkBox called chkMax set to Checked
7. ChkBox called chkRepeat set to Checked
8. Movie that you wish to default display copied to the Application Directory. I used "winsat.wmv", which I found in the \Windows\Performance" directory.
The Media Player options can only be set once the player has been started, hence the loop to check its state. Using the "Esc" key will return the program to the normal size.
J.A. Coutts