CMediaEvent Class


CMediaEvent class hierarchy

The CMediaEvent class provides base class implementation of the IDispatch methods of the dual-interface IMediaEvent. It leaves as pure virtual the properties and methods of the IMediaEvent interface.

The CMediaEvent class also provides base class implementation of the IMediaEventEx interface which derives from IMediaEvent.

The CMediaEvent::GetIDsOfNames, CMediaEvent::GetTypeInfo, CMediaEvent::GetTypeInfoCount, and CMediaEvent::Invoke member functions are standard implementations of the IDispatch interface using the CBaseDispatch class (and a type library) to parse the commands and pass them to the pure virtual methods of the IMediaEvent interface.

Member Functions
Name Description
CMediaEvent Constructs a CMediaEvent object.

Implemented INonDelegatingUnknown Methods
Name Description
NonDelegatingQueryInterface Returns a specified reference-counted interface.

Implemented IDispatch Methods
Name Description
GetIDsOfNames Maps a single member and an optional set of parameters to a corresponding set of integer dispatch identifiers, which can be used during subsequent calls to the IDispatch::Invoke method.
GetTypeInfo Retrieves a type-information object, which retrieves the type information for an interface.
GetTypeInfoCount Retrieves the number of type-information interfaces provided by an object.
Invoke Provides access to properties and methods exposed by an object.


CMediaEvent::CMediaEvent

CMediaEvent Class

Constructs a CMediaEvent object.

CMediaEvent(
  const TCHAR * pName,
  LPUNKNOWN pUnk
  );

Parameters
pName
Name of the object for debugging purposes.
pUnk
Pointer to the owner of this object.
Return Values

No return value.

Remarks

Allocate the pName parameter in static memory. This name appears on the debugging terminal upon creation and deletion of the object.


CMediaEvent::GetIDsOfNames

CMediaEvent Class

Maps a single member function and an optional set of parameters to a corresponding set of integer dispatch identifiers, which can be used upon subsequent calls to the CMediaEvent::Invoke member function.

HRESULT GetIDsOfNames(
  REFIID riid,
  OLECHAR ** rgszNames,
  UINT cNames,
  LCID lcid,
  DISPID * rgdispid
  );

Parameters
riid
Reference identifier. Reserved for future use. Must be NULL.
rgszNames
Passed-in array of names to be mapped.
cNames
Count of the names to be mapped.
lcid
Locale context in which to interpret the names.
rgdispid
Caller-allocated array, each element of which contains an ID corresponding to one of the names passed in the rgszNames array. The first element represents the member name; the subsequent elements represent each of the member's parameters.
Return Values

Returns one of the following values.
Value Meaning
DISP_E_UNKNOWN_CLSID The CLSID was not recognized.
DISP_E_UNKNOWNNAME One or more of the names were not known. The returned DISPIDs contain DISPID_UNKNOWN for each entry that corresponds to an unknown name.
E_OUTOFMEMORY Out of memory.
S_OK Success.


CMediaEvent::GetTypeInfo

CMediaEvent Class

Retrieves a type-information object, which can retrieve the type information for an interface.

HRESULT GetTypeInfo(
  UINT itinfo,
  LCID lcid,
  ITypeInfo ** pptinfo
  );

Parameters
itinfo
Type information to return. Pass zero to retrieve type information for the IDispatch implementation.
lcid
Locale ID for the type information. An object might be able to return different type information for different languages. This is important for classes that support localized member names. For classes that do not support localized member names, this parameter can be ignored.
pptinfo
Pointer to the type-information object requested.
Return Values

Returns an HRESULT value.


CMediaEvent::GetTypeInfoCount

CMediaEvent Class

Retrieves the number of type-information interfaces provided by an object.

HRESULT GetTypeInfoCount(
  UINT * pctinfo
  );

Parameters
pctinfo
Pointer to the location that receives the number of type-information interfaces that the object provides. If the object provides type information, this number is 1; otherwise, the number is 0.
Return Values

Returns an HRESULT value.


CMediaEvent::Invoke

CMediaEvent Class

Provides access to properties and methods exposed by an object.

HRESULT Invoke(
  DISPID dispidMember,
  REFIID riid,
  LCID lcid,
  WORD wFlags,
  DISPPARAMS * pdispparams,
  VARIANT * pvarResult,
  EXCEPINFO * pexcepinfo,
  UINT * puArgErr
  );

Parameters
dispidMember
Identifier of the member. Use CMediaEvent::GetIDsOfNames or the object's documentation to obtain the dispatch identifier.
riid
Reserved for future use. Must be IID_NULL.
lcid
Locale context in which to interpret arguments.
wFlags
Flags describing the context of the CMediaEvent::Invoke call.
pdispparams
Pointer to a structure containing an array of arguments, an array of argument dispatch IDs for named arguments, and counts for the number of elements in the arrays.
pvarResult
Pointer to where the result is to be stored, or NULL if the caller expects no result.
pexcepinfo
Pointer to a structure containing exception information.
puArgErr
Index of the first argument, within the rgvarg array, that has an error.
Return Values

Returns an HRESULT value.


CMediaEvent::NonDelegatingQueryInterface

CMediaEvent Class

Returns a specified reference-counted interface.

HRESULT NonDelegatingQueryInterface(
  REFIID riid,
  void **ppv
  );

Parameters
riid
Reference identifier.
ppv
Pointer to the interface.
Return Values

Returns a pointer to the IMediaEvent and IUnknown interfaces by default.

Remarks

Override this member function to publish any additional interfaces added by the derived class.

This member function implements the INonDelegatingUnknown::NonDelegatingQueryInterface method.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.