Share via


IMetaDataEmit::DefineEvent Method

Creates a definition for an event with the specified metadata signature, and gets a token to that event definition.

HRESULT DefineEvent ( 
    [in]  mdTypeDef    td, 
        [in]  LPCWSTR      szEvent, 
    [in]  DWORD        dwEventFlags, 
        [in]  mdToken      tkEventType, 
    [in]  mdMethodDef  mdAddOn, 
    [in]  mdMethodDef  mdRemoveOn, 
    [in]  mdMethodDef  mdFire, 
    [in]  mdMethodDef  rmdOtherMethods[], 
    [out] mdEvent      *pmdEvent 
);

Parameters

Parameter Description

td

[in] The token for the target class or interface.

szEvent

[in] The name of the event.

dwEventFlags

[in] Event flags.

tkEventType

[in] The token for the event class.

mdAddOn

[in] The method used to subscribe to the event, or NULL.

mdRemoveOn

[in] The method used to unsubscribe to the event, or NULL.

mdFire

[in] The method used (by a derived class) to raise the event.

rmdOtherMethods[]

[in] An array of tokens for other methods associated with the event.

pmdEvent

[out] The metadata token assigned to the event.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: Cor.h

Library: Used as a resource in Mscoree.dll

.NET Framework Version: 2.0, 1.1, 1.0

See Also

Reference

IMetaDataEmit Interface
IMetaDataEmit2 Interface