Windows Media Player SDK banner art
PreviousNext

Adding Button Controls

This topic applies to Windows Media Player version 6.4 only.

Next, add three CommandButton controls to your form, below the Windows Media Player control object. Change the caption on the first button to Start, on the second to Stop, and on the third to About. Add the following event procedures to the form's code view, so that Visual Basic will recognize when the buttons are clicked.

Private Sub Command1_Click()
    MediaPlayer1.Play
End Sub

Private Sub Command2_Click()
    MediaPlayer1.Stop
End Sub

Private Sub Command3_Click()
    MediaPlayer1.AboutBox
End Sub

Now, you can play and stop a multimedia file by clicking the Start and Stop buttons, respectively. After clicking the About button, a message box appears containing copyright and version information for the Windows Media Player control.

PreviousNext


© 2000-2001 Microsoft Corporation. All rights reserved.