Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

unregisterevent

Unregister event handler associated with COM object event at run time

Syntax

unregisterevent(c,eventhandler)

Description

example

unregisterevent(c,eventhandler) removes the association of a specific event handler routine from its corresponding event. Once you unregister an event, the object no longer responds to the event. You can unregister events at any time after creating a control.

Examples

collapse all

Unregister the EvtDeactivateHndlr event handler from a Microsoft® Excel® workbooks Deactivate event.

To run this example, create a workbook and register events.

myApp = actxserver('Excel.Application');
wbs = myApp.Workbooks;
wb = Add(wbs);
registerevent(wb,{'Activate' 'EvtActivateHndlr'; 'Deactivate' 'EvtDeactivateHndlr'})
eventlisteners(wb)
ans =

  2×2 cell array

    'Activate'      'EvtActivateHndlr'  
    'Deactivate'    'EvtDeactivateHndlr'

Unregister the Deactivate event handler. MATLAB® shows the remaining registered event (Activate) with its corresponding event handler.

unregisterevent(wb,{'Deactivate' 'EvtDeactivateHndlr'})
eventlisteners(wb)
ans =

  1×2 cell array

    'Activate'    'EvtActivateHndlr'

Input Arguments

collapse all

COM object, specified as a function handle.

Function to call when event occurs, specified as a cell array. specifies both events and event handlers.

Specify events in the eventhandler argument using the names of the events. Character vectors used in the eventhandler argument are not case-sensitive. unregisterevent does not accept numeric event identifiers.

Limitations

  • COM functions are available on Microsoft Windows® systems only.

Introduced before R2006a

Was this topic helpful?