VB6 app reference WMP on a Windows 7 x64

1.4k views Asked by At

I've helped developed a program which can enable gamers to manage their music, among other things, while a full screen game is open. Before I had an invisible copy of WMP control on a form and would just manipulate that copy to produce the desired effects, but now I'm getting requests from my users to remove the WMP control so that they can place the software on their dedicated servers. My question is how can I maintain WMP support by removing the control and instead add a reference to either msdxm.ocx or wmp.dll (or both) and create the WMP Object at runtime?

I'm dealing with systems ranging from 98 - W7. With wmp.dll and msdxm.ocx checked in references.

I've already tried:

Dim WMP as New WindowsMediaPlayer '(invalid use of Keyword New)

Dim WMP as WindowsMediaPlayer 
Set WMP = CreateObject("WMPlayer.OCX.7") '(failed to create WMP object)

These were the two most returned search results after 4 hours of Googling, so any help is appreciated. From what I've found out from v11+ of WMP stopped supporting VB6 all together, can anyone confirm this and if so let me know of a work around?

Frustrated but appreciative,

-Austin

1

There are 1 answers

0
wqw On

Try something like this

Private Sub Form_Load()
    Dim oWMP As Object
    Set oWMP = Controls.Add("WMPlayer.OCX", "wmpPlayer1")
    oWMP.Move 0, 0, ScaleWidth, ScaleHeight
    oWMP.Visible = True
End Sub