UNREGISTEREVENT

Purpose:

Removes a previously established event handler for an ActiveX event.

Syntax:

UNREGISTEREVENT(object, "eventname")

object

-

A handle to an ActiveX object.

"eventname"

-

A string, the name of the ActiveX event.

 

Alternate Syntax:

 

UNREGISTEREVENT(object, eventID)

object

-

A handle to an ActiveX object.

eventID

-

An integer, the ID of the the ActiveX event.

Returns:

An integer, 1 if successful.

Example:

Consider the following SPL function:

 

/* simple event handler */
MyEvent(argv)
{
    local i, str = "";
 
    loop (i = 1..argc)
    {
        str += sprintf("arg%d: %s ", i,
                       caststring(getargv(i)));
    }
 
    message("MyEvent", str);
}

 

The handler can be used to process events from Internet Explorer.

 

/* connect to Internet Explorer */
ie = createobject("internetexplorer.application");
 
/* navigate to home page */
ie.navigate("www.dadisp.com");
 
/* show it */
ie.visible = 1;
 
/* establish event handler */
registerevent(ie, "TitleChange", "MyEvent");

 

Each time the title displayed by Internet Explorer changes, MyEvent is called and a message box is displayed.

 

unregisterevent(ie, "TitleChange");

 

Removes the event handler from any future processing.

 

The event can also be specified by an integer event ID. For example:

 

unregisterevent(ie, 0x71);

Remarks:

The ActiveX event can be specified by name or integer ID.

 

See REGISTEREVENT to register an event handler.

 

UNREGISTEREVENT can also be called DELEVENTHANDLER.

See Also:

CREATEOBJECT

FIREEVENT

GETOBJECT

RAISEEVENT

REGISTEREVENT