Jump to content

ObjEvent Problem


Recommended Posts

I need some help with an object event. This is what I've tried, and a few other things, but I just can't get it.

ObjEvent ( $oDVD2, "DVDf_")
Func DVDf_DVDNotify("EC_DVD_DISC_EJECTED",0,0)
    MsgBox(0,0,0)
EndFunc

I'm trying to get the following events

EC_DVD_DISC_EJECTED

EC_DVD_DISC_INSERTED

EC_DVD_STILL_OFF

EC_DVD_STILL_ON

Here is a link to the info from msdn

http://msdn.microsoft.com/en-us/library/ms783428(VS.85).aspx

Thanks

Link to comment
Share on other sites

OK, I see that besides my basic syntax being wrong, msdn is saying that I need to set this up with something else. So corrected code should look like:

;$oDVD2 is the object
ObjEvent ( $oDVD2, "DVDf_")
Func DVDf_DVDNotify($aa, $bb, $cc)
    If $aa = "EC_DVD_DISC_EJECTED" then MsgBox(0,0,0)
EndFunc

But according to msdn http://msdn.microsoft.com/en-us/library/ms787383(VS.85).aspx , I need to declare the object using "WithEvents". How do I do that?

Link to comment
Share on other sites

  • 1 month later...

bump

still trying to fiGure out the "WithEvents" issue with this...anyone?

Here is something more to look at if that is needed. Only some of the notifications are showing...up until the movie actually starts, which is where I suspect the "WithEvents" comes into play.

$oDVD1 = ObjCreate("MSVidCtl.MSVidCtl.1")
$oDVD2 = ObjCreate("MSVidCtl.MSVidWebDVD.1")
If Not (IsObj($oDVD1) Or IsObj($oDVD2)) Then 
    MsgBox(262144+48,"Error","Failed to activate DVD ." & @CRLF & "DVD player will be unable to play DVDs.")
EndIf
$VideoGUI = GUICreate("", @DesktopWidth/2, @DesktopHeight/2)
GUISetBkColor(0x000000)
            $VideoObject = GUICtrlCreateObj($oDVD1, 0, 0, @DesktopWidth/2, @DesktopHeight/2)
            $oDVD1.View ("DVD:")
            $oDVD1.Build
            $oDVD2 = $oDVD1.InputActive
            $oDVD3 = $oDVD2.DVDAdm
            $oDVD2.DVDDirectory = "E:\\VIDEO_TS"
            $oDVD1.Run
    GUISetState(@SW_SHOW)

ObjEvent($oDVD2, "DVDf_")

While 1
    Sleep(60)
WEnd

Func DVDf_DVDNotify($a, $b, $c)
    ConsoleWrite("!Event 1 " & $a & @CRLF)
    ConsoleWrite("!Event 2 " & $b & @CRLF)
    ConsoleWrite("!Event 3 " & $c & @CRLF)
   ; If $aa = "282" then ConsoleWrite("Domain Change" & @CRLF)
EndFunc
Edited by Champak
Link to comment
Share on other sites

  • 2 months later...

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...