views:

30

answers:

1

I do not want a Windows Media Player control on my form. I am making an alarm clock. I have tried this:

Friend WithEvents WindowsMediaPlayer As New Microsoft.Win32.

But I do not see a Windows Media Player member.

Thank you.

I also asked on the MSDN VB Forum.

A: 

Your snippet is not complete. But nothing good will happen when you start with "Microsoft.Win32.". Begin with Project + Add Reference, Browse tab and select c:\windows\system32\wmp.dll. That adds a com interop wrapper with the namespace name "WMPLib". IntelliSense will now spring to life and show you the classes in that namespace. Make it resemble this:

Public Class Form1
  Friend WithEvents player As WMPLib.WindowsMediaPlayer

  Public Sub New()
    InitializeComponent()
    player = New WMPLib.WindowsMediaPlayer
  End Sub

  Private Sub player_StatusChange() Handles player.StatusChange
    ' A sample event handler...
  End Sub

End Class
Hans Passant