Jump to content

WMplayer Object not working...


BrettF
 Share

Recommended Posts

My Code:

$oPlayer = GUICtrlCreateObj("WMPlayer.OCX", 8, 0, 537, 281)
    If Not IsObj($oPlayer) Then
        MsgBox(0, "Error", "$oPlayer is not an Object.")
    Else
        MsgBox(0, "Error", "Successfully created Object $oPlayer.")
    EndIf
    $Button1 = GUICtrlCreateButton("", 360, 328, 41, 41, 0,$BS_BITMAP)
    GUICtrlSetImage ($Button1, @ScriptDir & "\play.bmp" )

My Problems:

First of all, I can't get the image to show on the button And $oPlayer is always returning- "$oPlayer is not an Object.". It will never show. :D, and where is the MSDN libary of wmplayer controls?? I cant find them anywhere... :D:P ...and ive looked hard.

Thanks :)

Link to comment
Share on other sites

  • Moderators

You must first create the object before creating the GUI Object.

#include <GUIConstants.au3>

$oPlayer = ObjCreate("WMPlayer.OCX")
If Not IsObj($oPlayer) Then
    MsgBox(0, "Error", "$oPlayer is not an Object.")
Else
    MsgBox(0, "Error", "Successfully created Object $oPlayer.")
EndIf

GUICreate("Test")
$hPlayer = GUICtrlCreateObj($oPlayer, 8, 0, 537, 281)
$Button1 = GUICtrlCreateButton("", 360, 328, 41, 41, 0, $BS_BITMAP)
GUICtrlSetImage($Button1, @ScriptDir & "\play.bmp")
GUISetState()

While 1
    Sleep(100)
WEnd
Link to comment
Share on other sites

You must first create the object before creating the GUI Object.

#include <GUIConstants.au3>

$oPlayer = ObjCreate("WMPlayer.OCX")
If Not IsObj($oPlayer) Then
    MsgBox(0, "Error", "$oPlayer is not an Object.")
Else
    MsgBox(0, "Error", "Successfully created Object $oPlayer.")
EndIf

GUICreate("Test")
$hPlayer = GUICtrlCreateObj($oPlayer, 8, 0, 537, 281)
$Button1 = GUICtrlCreateButton("", 360, 328, 41, 41, 0, $BS_BITMAP)
GUICtrlSetImage($Button1, @ScriptDir & "\play.bmp")
GUISetState()

While 1
    Sleep(100)
WEnd
It returns "$oPlayer is not an Object."... What should i have installed but probably wouldnt?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...