Interface inherited from IDispatch and implemented can have type information. Two member functions GetTypeInfoCount() and GetTypeInfo() have to be implemented in order to support type information. Function reference of GetTypeInfoCount(), GetTypeInfo() has been listed below.

IDispatch::GetTypeInfoCount()
Retrieves the number of type information interfaces that an object provides (either 0 or 1).

HRESULT GetTypeInfoCount(  
  unsigned int FAR*  pctinfo 
);
Parameter
pctinfo - Points to a location that receives the number of type information interfaces provided by the object. If the object provides type information, this number is 1; otherwise the number is 0.

Return Value
The return value obtained from the returned HRESULT.
S_OK - Success.
E_NOTIMPL - Failure.

Comments
The function may return zero, which indicates that the object does not provide any type information. In this case, the object may still be programmable through IDispatch or a VTBL, but does not provide run-time type information for browsers, compilers, or other programming tools that access type information. This can be useful for hiding an object from browsers.

IDispatch::GetTypeInfo()
Retrieves the type information for an object, which can then be used to get the type information for an interface.

HRESULT GetTypeInfo(  
  unsigned int  iTInfo,         
  LCID  lcid,                   
  ITypeInfo FAR* FAR*  ppTInfo  
);
Parameters
iTInfo - The type information to return. Pass 0 to retrieve type information for the IDispatch implementation.
lcid - The locale identifier for the type information. An object may 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 - Receives a pointer to the requested type information object.

Return Value
The return value obtained from the returned HRESULT.
S_OK - Success; the type information element exists.
DISP_E_BADINDEX - Failure; iTInfo argument was not 0.

About our authors: Team EQA

You have viewed 1 page out of 67. Your COM/DCOM learning is 0.00% complete. Login to check your learning progress.

#