GetTypeInfoCount

 (Available in 01 TS COM - TS_COM_IDispatch)

Purpose

Test if the interface supports typeinfo

Syntax

hResult:=oSomeIObject:GetTypeInfoCount( @iTypeInfoCount )

Arguments

pTypeInfoCount
INT PTR

Description

Test if the interface supports typeinfo, If the interface supports typeinfo this methos will return 1 else 0.

MSDN ==== 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 is one of the following:

Return value Meaning 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.

Returns

hResult

Example

LOCAL iTypeInfoCount AS INT
hResult:=oSomeIObject:GetTypeInfoCount( @iTypeInfoCount )
IF TS_Succeeded( hResult )
   IF iTypeInfoCount<>0
//    The interface supports type info
   ELSE
//    No typeinfo available on this interface
   END
END

Source

METHOD GetTypeInfoCount( pTypeInfoCount AS INT PTR ) AS LONG PASCAL CLASS TS_IDispatch
LOCAL oAIOuterDispatch AS TS_AbstractIDispatch
LOCAL hResult AS LONG
   TSTrace Enter
   TSTrace ToDo NB "Aggregation needs TO be tested"
   DO CASE
   CASE !SELF:IsValidObject
      TSTrace Warning "!SELF:IsValidObject"
      IF pTypeInfoCount<>NULL_PTR
         INT( pTypeInfoCount ):=0
      ELSE
         TSTrace Warning "pTypeInfoCount==NULL_PTR"
      END
      hResult:=E_NOTIMPL
   CASE LOGIC( _CAST, SELF:_OuterAIUnknown )
      #IFDEF TS_TRACETIMED_ENABLE
         _TS_TraceTimedEnter( TS_TT_SYM_EXTERNAL, TS_TT_SYM_OUTERAIUNKNOWN, #QueryInterface  ; ...
        ... )
      #ENDIF
      hResult:=SELF:_OuterAIUnknown:QueryInterface(  ; ...
     ... TS_GUID_IDispatch( ), @oAIOuterDispatch )
      #IFDEF TS_TRACETIMED_ENABLE
         _TS_TraceTimedLeave( TS_TT_SYM_EXTERNAL, TS_TT_SYM_OUTERAIUNKNOWN, #QueryInterface  ; ...
        ... )
      #ENDIF
      IF TS_HSucceeded( hResult, TRUE )
         hResult:=oAIOuterDispatch:GetTypeInfoCount( pTypeInfoCount )
         oAIOuterDispatch:Release( )
         oAIOuterDispatch:=NULL_OBJECT
      ELSE
         TSTrace Warning "!TS_HSucceeded(SELF:_OuterAIUnknown:QueryInterface(TS_GUID_IDispatch()" ; ...
        ... +",@oAIOuterDispatch),TRUE)"
         hResult:=DISP_E_UNKNOWNNAME
      END
   OTHERWISE
      hResult:=SELF:_InternalGetTypeInfoCount( pTypeInfoCount  ; ...
     ... )
   END
   TSTrace Leave
RETURN hResult