#include "FiveWin.ch"
function Main()
local o := CreateObject( "ADODB.Recordset" )
// local pTypeInfo
if GetTypeInfoCount( o:hObj ) == 1 // There is info
// pTypeInfo = TOleAuto():New( GetTypeInfo( o:hObj ) )
// MsgInfo( pTypeInfo:GetType() )
// GetType( o:hObj )
if Len( GetTypeVars( o:hObj ) ) > 0
XBROWSER GetTypeVars( o:hObj ) TITLE "Variables"
endif
XBROWSER ASort( GetTypeFuncs( o:hObj ) ) TITLE "Functions"
endif
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include "c:\harbour\contrib\hbwin\hbwinole.h"
HB_FUNC( GETTYPEINFOCOUNT )
{
IDispatch * pDisp = hb_oleParam( 1 );
HRESULT lOleError;
UINT ctinfo;
lOleError = HB_VTBL( pDisp )->GetTypeInfoCount( HB_THIS( pDisp ), &ctinfo );
hb_retnl( ( lOleError == S_OK ) ? ctinfo: -1 );
}
static LPSTR WideToAnsi( LPWSTR cWide )
{
WORD wLen;
LPSTR cString = NULL;
wLen = WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, 0, NULL, NULL );
cString = ( LPSTR ) hb_xgrab( wLen );
WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, wLen, NULL, NULL );
return cString;
}
HB_FUNC( GETTYPEINFO )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) == S_OK )
hb_oleItemPut( hb_stackReturnItem(), ( IDispatch * ) pInfo );
else
hb_ret();
}
HB_FUNC( GETTYPE )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
HRESULT lOleError;
TYPEATTR * pta;
int i;
lOleError = HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo );
lOleError = HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta );
}
HB_FUNC( GETTYPEVARS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
HRESULT lOleError;
TYPEATTR * pta;
int i;
lOleError = HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo );
lOleError = HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta );
hb_reta( pta->cVars );
for( i = 0; i < pta->cVars; i++ )
{
BSTR bsName;
VARDESC * pVar;
char * pszName;
lOleError = HB_VTBL( pInfo )->GetVarDesc( HB_THIS( pInfo ), i, &pVar );
lOleError = HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pVar->memid, &bsName, NULL, NULL, NULL );
pszName = WideToAnsi( bsName );
hb_storvclen( pszName, strlen( pszName ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseVarDesc( HB_THIS( pInfo ), pVar );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
HB_FUNC( GETTYPEFUNCS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
HRESULT lOleError;
TYPEATTR * pta;
int i;
lOleError = HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo );
lOleError = HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta );
hb_reta( pta->cFuncs );
for( i = 0; i < pta->cFuncs; i++ )
{
BSTR bsName;
FUNCDESC * pfd;
char * pszName;
char * pszType;
char buffer[ 100 ];
lOleError = HB_VTBL( pInfo )->GetFuncDesc( HB_THIS( pInfo ), i, &pfd );
// lOleError = HB_VTBL( pInfo )->GetNames( HB_THIS( pInfo ), pfd->memid, &bsName, 1, &uiNames );
lOleError = HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pfd->memid, &bsName, NULL, NULL, NULL );
pszName = WideToAnsi( bsName );
switch( pfd->elemdescFunc.tdesc.vt )
{
case VT_PTR:
pszType = "PTR";
break;
case VT_ARRAY:
pszType = "ARRAY";
break;
case VT_CARRAY:
pszType = "CARRAY";
break;
case VT_USERDEFINED:
pszType = "USERDEFINED";
break;
case VT_I2:
pszType = "short";
break;
case VT_I4:
pszType = "int";
break;
case VT_R4:
pszType = "float";
break;
case VT_R8:
pszType = "double";
break;
case VT_CY:
pszType = "CY";
break;
case VT_DATE:
pszType = "DATE";
break;
case VT_BSTR:
pszType = "BSTR";
break;
case VT_DECIMAL:
pszType = "DECIMAL";
break;
case VT_DISPATCH:
pszType = "IDispatch";
break;
case VT_ERROR:
pszType = "SCODE";
break;
case VT_BOOL:
pszType = "VARIANT_BOOL";
break;
case VT_VARIANT:
pszType = "VARIANT";
break;
case VT_UNKNOWN:
pszType = "IUnknown";
break;
case VT_UI1:
pszType = "BYTE";
break;
case VT_I1:
pszType = "char";
break;
case VT_UI2:
pszType = "unsigned short";
break;
case VT_UI4:
pszType = "unsigned long";
break;
case VT_I8:
pszType = "__int64";
break;
case VT_UI8:
pszType = "unsigned __int64";
break;
case VT_INT:
pszType = "int";
break;
case VT_UINT:
pszType = "unsigned int";
break;
case VT_HRESULT:
pszType = "HRESULT";
case VT_VOID:
pszType = "void";
break;
case VT_LPSTR:
pszType = "char *";
break;
case VT_LPWSTR:
pszType = "wchar *";
break;
default:
pszType = "Error";
break;
}
sprintf( buffer, "%s %s()\n", pszType, pszName );
hb_storvclen( buffer, strlen( buffer ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseFuncDesc( HB_THIS( pInfo ), pfd );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
#pragma ENDDUMP
#include "FiveWin.ch"
function Main()
local o := CreateObject( "ADODB.Recordset" )
local aVars, aFuncs
if GetTypeInfoCount( o:hObj ) == 1 // There is info
if Len( aVars := GetTypeVars( o:hObj ) ) > 0
XBROWSER ASort( aVars ) TITLE "Variables"
endif
if Len( aFuncs := GetTypeFuncs( o:hObj ) ) > 0
XBROWSER ASort( aFuncs ) TITLE "Functions"
endif
endif
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include "c:\harbour\contrib\hbwin\hbwinole.h"
HB_FUNC( GETTYPEINFOCOUNT )
{
IDispatch * pDisp = hb_oleParam( 1 );
HRESULT lOleError;
UINT ctinfo;
lOleError = HB_VTBL( pDisp )->GetTypeInfoCount( HB_THIS( pDisp ), &ctinfo );
hb_retnl( ( lOleError == S_OK ) ? ctinfo: -1 );
}
static LPSTR WideToAnsi( LPWSTR cWide )
{
WORD wLen;
LPSTR cString = NULL;
wLen = WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, 0, NULL, NULL );
cString = ( LPSTR ) hb_xgrab( wLen );
WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, wLen, NULL, NULL );
return cString;
}
HB_FUNC( GETTYPEVARS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
TYPEATTR * pta;
int i;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) != S_OK )
return;
if( HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta ) != S_OK )
return;
hb_reta( pta->cVars );
for( i = 0; i < pta->cVars; i++ )
{
BSTR bsName;
VARDESC * pVar;
char * pszName;
if( HB_VTBL( pInfo )->GetVarDesc( HB_THIS( pInfo ), i, &pVar ) != S_OK )
break;
if( HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pVar->memid, &bsName, NULL, NULL, NULL ) != S_OK )
break;
pszName = WideToAnsi( bsName );
hb_storvclen( pszName, strlen( pszName ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseVarDesc( HB_THIS( pInfo ), pVar );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
static char * GetType( unsigned int iType )
{
char * pszType;
switch( iType )
{
case VT_PTR:
pszType = "PTR";
break;
case VT_ARRAY:
pszType = "ARRAY";
break;
case VT_CARRAY:
pszType = "CARRAY";
break;
case VT_USERDEFINED:
pszType = "USERDEFINED";
break;
case VT_I2:
pszType = "short";
break;
case VT_I4:
pszType = "int";
break;
case VT_R4:
pszType = "float";
break;
case VT_R8:
pszType = "double";
break;
case VT_CY:
pszType = "CY";
break;
case VT_DATE:
pszType = "DATE";
break;
case VT_BSTR:
pszType = "BSTR";
break;
case VT_DECIMAL:
pszType = "DECIMAL";
break;
case VT_DISPATCH:
pszType = "IDispatch";
break;
case VT_ERROR:
pszType = "SCODE";
break;
case VT_BOOL:
pszType = "VARIANT_BOOL";
break;
case VT_VARIANT:
pszType = "VARIANT";
break;
case VT_UNKNOWN:
pszType = "IUnknown";
break;
case VT_UI1:
pszType = "BYTE";
break;
case VT_I1:
pszType = "char";
break;
case VT_UI2:
pszType = "unsigned short";
break;
case VT_UI4:
pszType = "unsigned long";
break;
case VT_I8:
pszType = "__int64";
break;
case VT_UI8:
pszType = "unsigned __int64";
break;
case VT_INT:
pszType = "int";
break;
case VT_UINT:
pszType = "unsigned int";
break;
case VT_HRESULT:
pszType = "HRESULT";
break;
case VT_VOID:
pszType = "void";
break;
case VT_LPSTR:
pszType = "char *";
break;
case VT_LPWSTR:
pszType = "wchar *";
break;
default:
pszType = "Error";
break;
}
return pszType;
}
HB_FUNC( GETTYPEFUNCS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
HRESULT lOleError;
TYPEATTR * pta;
int i;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) != S_OK )
{
hb_ret();
return;
}
if( HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta ) != S_OK )
{
hb_ret();
return;
}
hb_reta( pta->cFuncs );
for( i = 0; i < pta->cFuncs; i++ )
{
BSTR bsName;
FUNCDESC * pfd;
char * pszName;
char * pszType;
char buffer[ 100 ];
int n;
if( HB_VTBL( pInfo )->GetFuncDesc( HB_THIS( pInfo ), i, &pfd ) != S_OK )
break;
if( HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pfd->memid, &bsName, NULL, NULL, NULL ) != S_OK )
break;
pszName = WideToAnsi( bsName );
sprintf( buffer, "%s %s(", GetType( pfd->elemdescFunc.tdesc.vt ), pszName );
for( n = 0; n < pfd->cParams; n++ )
{
if( n != 0 )
strcat( buffer, ", " );
else
strcat( buffer, " " );
strcat( buffer, GetType( pfd->lprgelemdescParam[ n ].tdesc.vt ) );
if( n == pfd->cParams - 1 )
strcat( buffer, " " );
}
strcat( buffer, ")" );
hb_storvclen( buffer, strlen( buffer ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseFuncDesc( HB_THIS( pInfo ), pfd );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
#pragma ENDDUMP
#include "FiveWin.ch"
function Main()
local o := CreateObject( "ADODB.Recordset" )
local aVars, aFuncs
if GetTypeInfoCount( o:hObj ) == 1 // There is info
if Len( aVars := GetTypeVars( o:hObj ) ) > 0
XBROWSER ASort( aVars ) TITLE "Variables"
endif
if Len( aFuncs := GetTypeFuncs( o:hObj ) ) > 0
XBROWSER ASort( aFuncs ) TITLE "Functions"
endif
endif
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include "c:\harbour\contrib\hbwin\hbwinole.h"
HB_FUNC( GETTYPEINFOCOUNT )
{
IDispatch * pDisp = hb_oleParam( 1 );
HRESULT lOleError;
UINT ctinfo;
lOleError = HB_VTBL( pDisp )->GetTypeInfoCount( HB_THIS( pDisp ), &ctinfo );
hb_retnl( ( lOleError == S_OK ) ? ctinfo: -1 );
}
static LPSTR WideToAnsi( LPWSTR cWide )
{
WORD wLen;
LPSTR cString = NULL;
wLen = WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, 0, NULL, NULL );
cString = ( LPSTR ) hb_xgrab( wLen );
WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, wLen, NULL, NULL );
return cString;
}
HB_FUNC( GETTYPEVARS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
TYPEATTR * pta;
int i;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) != S_OK )
return;
if( HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta ) != S_OK )
return;
hb_reta( pta->cVars );
for( i = 0; i < pta->cVars; i++ )
{
BSTR bsName;
VARDESC * pVar;
char * pszName;
if( HB_VTBL( pInfo )->GetVarDesc( HB_THIS( pInfo ), i, &pVar ) != S_OK )
break;
if( HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pVar->memid, &bsName, NULL, NULL, NULL ) != S_OK )
break;
pszName = WideToAnsi( bsName );
hb_storvclen( pszName, strlen( pszName ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseVarDesc( HB_THIS( pInfo ), pVar );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
static char * GetType( unsigned int iType )
{
char * pszType;
switch( iType )
{
case VT_PTR:
pszType = "PTR";
break;
case VT_ARRAY:
pszType = "ARRAY";
break;
case VT_CARRAY:
pszType = "CARRAY";
break;
case VT_USERDEFINED:
pszType = "USERDEFINED";
break;
case VT_I2:
pszType = "short";
break;
case VT_I4:
pszType = "int";
break;
case VT_R4:
pszType = "float";
break;
case VT_R8:
pszType = "double";
break;
case VT_CY:
pszType = "CY";
break;
case VT_DATE:
pszType = "DATE";
break;
case VT_BSTR:
pszType = "BSTR";
break;
case VT_DECIMAL:
pszType = "DECIMAL";
break;
case VT_DISPATCH:
pszType = "IDispatch";
break;
case VT_ERROR:
pszType = "SCODE";
break;
case VT_BOOL:
pszType = "VARIANT_BOOL";
break;
case VT_VARIANT:
pszType = "VARIANT";
break;
case VT_UNKNOWN:
pszType = "IUnknown";
break;
case VT_UI1:
pszType = "BYTE";
break;
case VT_I1:
pszType = "char";
break;
case VT_UI2:
pszType = "unsigned short";
break;
case VT_UI4:
pszType = "unsigned long";
break;
case VT_I8:
pszType = "__int64";
break;
case VT_UI8:
pszType = "unsigned __int64";
break;
case VT_INT:
pszType = "int";
break;
case VT_UINT:
pszType = "unsigned int";
break;
case VT_HRESULT:
pszType = "HRESULT";
break;
case VT_VOID:
pszType = "void";
break;
case VT_LPSTR:
pszType = "char *";
break;
case VT_LPWSTR:
pszType = "wchar *";
break;
default:
pszType = "Error";
break;
}
return pszType;
}
static char * GetFuncKind( unsigned int iType )
{
char * pszType;
switch( iType )
{
case FUNC_PUREVIRTUAL:
pszType = "virtual";
break;
case FUNC_STATIC:
pszType = "static";
break;
case FUNC_DISPATCH:
pszType = "dispatch";
break;
default:
pszType = "error";
break;
}
return pszType;
}
static char * GetInvKind( unsigned int iType )
{
char * pszType;
switch( iType )
{
case INVOKE_FUNC:
pszType = "FUNC";
break;
case INVOKE_PROPERTYGET:
pszType = "PROPERTYGET";
break;
case INVOKE_PROPERTYPUT:
pszType = "PROPERTYPUT";
break;
case INVOKE_PROPERTYPUTREF:
pszType = "PROPERTYPUTREF";
break;
default:
pszType = "error";
break;
}
return pszType;
}
HB_FUNC( GETTYPEFUNCS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
HRESULT lOleError;
TYPEATTR * pta;
int i;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) != S_OK )
{
hb_ret();
return;
}
if( HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta ) != S_OK )
{
hb_ret();
return;
}
hb_reta( pta->cFuncs );
for( i = 0; i < pta->cFuncs; i++ )
{
BSTR bsName;
FUNCDESC * pfd;
char * pszName;
char * pszType;
char buffer[ 100 ];
int n;
if( HB_VTBL( pInfo )->GetFuncDesc( HB_THIS( pInfo ), i, &pfd ) != S_OK )
break;
if( HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pfd->memid, &bsName, NULL, NULL, NULL ) != S_OK )
break;
pszName = WideToAnsi( bsName );
sprintf( buffer, "%s %s %s %s(", GetFuncKind( pfd->funckind ), GetInvKind( pfd->invkind ),
GetType( pfd->elemdescFunc.tdesc.vt ), pszName );
for( n = 0; n < pfd->cParams; n++ )
{
if( n != 0 )
strcat( buffer, ", " );
else
strcat( buffer, " " );
strcat( buffer, GetType( pfd->lprgelemdescParam[ n ].tdesc.vt ) );
if( n == pfd->cParams - 1 )
strcat( buffer, " " );
}
strcat( buffer, ")" );
hb_storvclen( buffer, strlen( buffer ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseFuncDesc( HB_THIS( pInfo ), pfd );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
#pragma ENDDUMP
// Docs: http://msdn.microsoft.com/en-us/library/cc237619.aspx
#include "FiveWin.ch"
function Main()
local o := CreateObject( "ADODB.Recordset" )
local aVars, aFuncs
if GetTypeInfoCount( o:hObj ) == 1 // There is info
if Len( aVars := GetTypeVars( o:hObj ) ) > 0
XBROWSER ASort( aVars ) TITLE "Variables"
endif
if Len( aFuncs := GetTypeFuncs( o:hObj ) ) > 0
XBROWSER ASort( aFuncs ) TITLE "Functions"
endif
endif
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include "c:\harbour\contrib\hbwin\hbwinole.h"
HB_FUNC( GETTYPEINFOCOUNT )
{
IDispatch * pDisp = hb_oleParam( 1 );
HRESULT lOleError;
UINT ctinfo;
lOleError = HB_VTBL( pDisp )->GetTypeInfoCount( HB_THIS( pDisp ), &ctinfo );
hb_retnl( ( lOleError == S_OK ) ? ctinfo: -1 );
}
static LPSTR WideToAnsi( LPWSTR cWide )
{
WORD wLen;
LPSTR cString = NULL;
wLen = WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, 0, NULL, NULL );
cString = ( LPSTR ) hb_xgrab( wLen );
WideCharToMultiByte( CP_ACP, 0, cWide, -1, cString, wLen, NULL, NULL );
return cString;
}
HB_FUNC( GETTYPEVARS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
TYPEATTR * pta;
int i;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) != S_OK )
return;
if( HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta ) != S_OK )
return;
hb_reta( pta->cVars );
for( i = 0; i < pta->cVars; i++ )
{
BSTR bsName;
VARDESC * pVar;
char * pszName;
if( HB_VTBL( pInfo )->GetVarDesc( HB_THIS( pInfo ), i, &pVar ) != S_OK )
break;
if( HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pVar->memid, &bsName, NULL, NULL, NULL ) != S_OK )
break;
pszName = WideToAnsi( bsName );
hb_storvclen( pszName, strlen( pszName ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseVarDesc( HB_THIS( pInfo ), pVar );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
static char * GetType( unsigned int iType )
{
char * pszType;
switch( iType )
{
case VT_PTR:
pszType = "PTR";
break;
case VT_ARRAY:
pszType = "ARRAY";
break;
case VT_CARRAY:
pszType = "CARRAY";
break;
case VT_USERDEFINED:
pszType = "USERDEFINED";
break;
case VT_I2:
pszType = "short";
break;
case VT_I4:
pszType = "int";
break;
case VT_R4:
pszType = "float";
break;
case VT_R8:
pszType = "double";
break;
case VT_CY:
pszType = "CY";
break;
case VT_DATE:
pszType = "DATE";
break;
case VT_BSTR:
pszType = "BSTR";
break;
case VT_DECIMAL:
pszType = "DECIMAL";
break;
case VT_DISPATCH:
pszType = "IDispatch";
break;
case VT_ERROR:
pszType = "SCODE";
break;
case VT_BOOL:
pszType = "VARIANT_BOOL";
break;
case VT_VARIANT:
pszType = "VARIANT";
break;
case VT_UNKNOWN:
pszType = "IUnknown";
break;
case VT_UI1:
pszType = "BYTE";
break;
case VT_I1:
pszType = "char";
break;
case VT_UI2:
pszType = "unsigned short";
break;
case VT_UI4:
pszType = "unsigned long";
break;
case VT_I8:
pszType = "__int64";
break;
case VT_UI8:
pszType = "unsigned __int64";
break;
case VT_INT:
pszType = "int";
break;
case VT_UINT:
pszType = "unsigned int";
break;
case VT_HRESULT:
pszType = "HRESULT";
break;
case VT_VOID:
pszType = "void";
break;
case VT_LPSTR:
pszType = "char *";
break;
case VT_LPWSTR:
pszType = "wchar *";
break;
default:
pszType = "Error";
break;
}
return pszType;
}
static char * GetFuncKind( unsigned int iType )
{
char * pszType;
switch( iType )
{
case FUNC_PUREVIRTUAL:
pszType = "virtual";
break;
case FUNC_STATIC:
pszType = "static";
break;
case FUNC_DISPATCH:
pszType = "dispatch";
break;
default:
pszType = "error";
break;
}
return pszType;
}
static char * GetInvKind( unsigned int iType )
{
char * pszType;
switch( iType )
{
case INVOKE_FUNC:
pszType = "FUNC";
break;
case INVOKE_PROPERTYGET:
pszType = "PROPERTYGET";
break;
case INVOKE_PROPERTYPUT:
pszType = "PROPERTYPUT";
break;
case INVOKE_PROPERTYPUTREF:
pszType = "PROPERTYPUTREF";
break;
default:
pszType = "error";
break;
}
return pszType;
}
static char * GetCallConv( unsigned int iType )
{
char * pszType;
switch( iType )
{
case CC_CDECL:
pszType = "CDECL";
break;
case CC_PASCAL:
pszType = "PASCAL";
break;
case CC_STDCALL:
pszType = "STDCALL";
break;
default:
pszType = "error";
break;
}
return pszType;
}
static char * GetParamType( USHORT iType )
{
char * pszType = "error";
if( iType & PARAMFLAG_NONE )
pszType = "";
if( iType & PARAMFLAG_FIN )
pszType = "[in]";
if( iType & PARAMFLAG_FOUT )
pszType = "[out]";
if( iType & PARAMFLAG_FLCID )
pszType = "[lcid]";
if( iType & PARAMFLAG_FRETVAL )
pszType = "[retval]";
if( iType & PARAMFLAG_FOPT )
pszType = "[optional]";
if( iType & PARAMFLAG_FHASDEFAULT )
pszType = "[defaultvalue]";
if( iType & PARAMFLAG_FHASCUSTDATA )
pszType = "[custom]";
return pszType;
}
HB_FUNC( GETTYPEFUNCS )
{
IDispatch * pDisp = hb_oleParam( 1 );
ITypeInfo * pInfo;
HRESULT lOleError;
TYPEATTR * pta;
int i;
if( HB_VTBL( pDisp )->GetTypeInfo( HB_THIS( pDisp ), 0, 0, &pInfo ) != S_OK )
{
hb_ret();
return;
}
if( HB_VTBL( pInfo )->GetTypeAttr( HB_THIS( pInfo ), &pta ) != S_OK )
{
hb_ret();
return;
}
hb_reta( pta->cFuncs );
for( i = 0; i < pta->cFuncs; i++ )
{
BSTR bsName;
FUNCDESC * pfd;
char * pszName;
char * pszType;
char buffer[ 200 ];
int n;
if( HB_VTBL( pInfo )->GetFuncDesc( HB_THIS( pInfo ), i, &pfd ) != S_OK )
break;
if( HB_VTBL( pInfo )->GetDocumentation( HB_THIS( pInfo ), pfd->memid, &bsName, NULL, NULL, NULL ) != S_OK )
break;
pszName = WideToAnsi( bsName );
sprintf( buffer, "%s %s %s %s %s(", GetCallConv( pfd->callconv ),
GetFuncKind( pfd->funckind ), GetInvKind( pfd->invkind ),
GetType( pfd->elemdescFunc.tdesc.vt ), pszName );
for( n = 0; n < pfd->cParams; n++ )
{
if( n != 0 )
strcat( buffer, ", " );
else
strcat( buffer, " " );
strcat( buffer, GetParamType( pfd->lprgelemdescParam[ n ].paramdesc.wParamFlags ) );
strcat( buffer, " " );
strcat( buffer, GetType( pfd->lprgelemdescParam[ n ].tdesc.vt ) );
if( n == pfd->cParams - 1 )
strcat( buffer, " " );
}
strcat( buffer, ")" );
hb_storvclen( buffer, strlen( buffer ), -1, i + 1 );
hb_xfree( ( void * ) pszName );
HB_VTBL( pInfo )->ReleaseFuncDesc( HB_THIS( pInfo ), pfd );
}
HB_VTBL( pInfo )->Release( HB_THIS( pInfo ) );
}
#pragma ENDDUMP
function Main()
local o := CreateObject( "Excel.Application" ) //WinWordObj() //CreateObject( "Word.Application" )
local aVars, aFuncs
if GetTypeInfoCount( o:hObj ) == 1 // There is info
msginfo("1")
if Len( aVars := GetTypeVars( o:hObj ) ) > 0
msginfo("2")
XBROWSER ASort( aVars ) TITLE "Variables"
else
msginfo("nada 2")
endif
msginfo("aqui")
if Len( aFuncs := GetTypeFuncs( o:hObj ) ) > 0
msginfo("3")
XBROWSER ASort( aFuncs ) TITLE "Functions"
else
msginfo("nada 3")
endif
else
msginfo("nada 1")
endif
return nil
function Main()
local o := CreateObject( "Scripting.FileSystemObject" )
local aVars, aFuncs, cFuncs := ""
if GetTypeInfoCount( o:hObj ) == 1 // There is info
if Len( aVars := GetTypeVars( o:hObj ) ) > 0
XBROWSER ASort( aVars ) TITLE "Variables"
endif
if Len( aFuncs := GetTypeFuncs( o:hObj ) ) > 0
AEval( aFuncs, { | c | cFuncs += c + CRLF } )
MemoEdit( cFuncs )
endif
endif
return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 40 guests