0

I don't want a Windows Media Player control on my form. I'm making an alarm clock. I have tried this:

Friend WithEvents WindowsMediaPlayer As New Microsoft.Win32.

But I don't see a Windows Media Player member.

Thank you.

I also asked on the MSDN VB Forum.

DarkAjax
  • 15,955
  • 11
  • 53
  • 65
Geoffrey
  • 5,407
  • 10
  • 43
  • 78

1 Answers1

0

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
  • 922,412
  • 146
  • 1,693
  • 2,536