From cde1450b16614e6b4643c5111abcdea1748b9b28 Mon Sep 17 00:00:00 2001 From: "Alexander S.Kresin" Date: Sat, 4 Oct 2003 16:20:48 +0000 Subject: [PATCH] 2003-10-04 20:18 UTC+0300 Alexander Kresin --- harbour/ChangeLog | 6 +++ harbour/contrib/ole/Makefile | 15 ++++++ harbour/contrib/ole/ole2.c | 93 +++++++++++++++++++++++++++++++++++- 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 harbour/contrib/ole/Makefile diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7bae5daaa7..749041ad01 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,12 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2003-10-04 20:18 UTC+0300 Alexander Kresin + * contrib/ole/ole2.c + * Some changes needed for Mingw. + + contrib/ole/Makefile + + Makefile added. + 2003-09-29 16:12 UTC-0800 Luis Krause Mantilla * contrib/rdd_ads/adsfunc.c * contrib/rdd_ads/doc/en/adsfuncs.txt diff --git a/harbour/contrib/ole/Makefile b/harbour/contrib/ole/Makefile new file mode 100644 index 0000000000..f1baf72a28 --- /dev/null +++ b/harbour/contrib/ole/Makefile @@ -0,0 +1,15 @@ +# +# $Id$ +# + +ROOT = ../../ + +C_SOURCES=\ + ole2.c \ + +PRG_SOURCES=\ + oleauto.prg \ + +LIBNAME=hbole + +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/ole/ole2.c b/harbour/contrib/ole/ole2.c index 1c10cc06df..9d39ae78b7 100644 --- a/harbour/contrib/ole/ole2.c +++ b/harbour/contrib/ole/ole2.c @@ -73,6 +73,8 @@ * * \************************************************************************/ +#define HB_OS_WIN_32_USED + #include #include @@ -154,42 +156,78 @@ static void GetParams(DISPPARAMS * dParams) switch( uParam->type ) { case '\0': +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_EMPTY; +#else pArgs[ n ].n1.n2.vt = VT_EMPTY; +#endif break; case HB_IT_STRING: case HB_IT_MEMO: +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_BSTR; +#else pArgs[ n ].n1.n2.vt = VT_BSTR; +#endif cString = AnsiToWide( hb_parc( nArg ) ); +#if !defined(__BORLANDC__) + pArgs[ n ].bstrVal = SysAllocString( (LPVOID) cString ); +#else pArgs[ n ].n1.n2.n3.bstrVal = SysAllocString( (LPVOID) cString ); +#endif hb_xfree( cString ); break; case HB_IT_LOGICAL: +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_BOOL; + pArgs[ n ].boolVal = hb_parl( nArg ); +#else pArgs[ n ].n1.n2.vt = VT_BOOL; - pArgs[ n ].n1.n2.n3.boolVal = hb_parl( nArg ); + pArgs[ n ].n1.n2.n3.boolVal = hb_parl( nArg ); +#endif break; case HB_IT_INTEGER: case HB_IT_LONG: case HB_IT_NUMERIC: +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_I4; + pArgs[ n ].lVal = hb_parnl( nArg ); +#else pArgs[ n ].n1.n2.vt = VT_I4; pArgs[ n ].n1.n2.n3.lVal = hb_parnl( nArg ); +#endif break; case HB_IT_DOUBLE: +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_R8; + pArgs[ n ].dblVal = hb_parnd( nArg ); +#else pArgs[ n ].n1.n2.vt = VT_R8; pArgs[ n ].n1.n2.n3.dblVal = hb_parnd( nArg ); +#endif break; case HB_IT_DATE: +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_DATE; + pArgs[ n ].dblVal = DateToDbl( hb_pards( nArg ) ); +#else pArgs[ n ].n1.n2.vt = VT_DATE; pArgs[ n ].n1.n2.n3.dblVal = DateToDbl( hb_pards( nArg ) ); +#endif break; case HB_IT_OBJECT: { PHB_DYNS pData; +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_EMPTY; +#else pArgs[ n ].n1.n2.vt = VT_EMPTY; +#endif if ( hb_stricmp( hb_objGetClsName( uParam ), "TOleAuto" ) == 0 ) { pData = hb_dynsymFindName( "hObj" ); @@ -198,8 +236,13 @@ static void GetParams(DISPPARAMS * dParams) hb_vmPushSymbol( pData->pSymbol ); hb_vmPush( uParam ); hb_vmDo( 0 ); +#if !defined(__BORLANDC__) + pArgs[ n ].vt = VT_DISPATCH; + pArgs[ n ].pdispVal = ( IDispatch * ) hb_parnl( -1 ); +#else pArgs[ n ].n1.n2.vt = VT_DISPATCH; pArgs[ n ].n1.n2.n3.pdispVal = ( IDispatch * ) hb_parnl( -1 ); +#endif } } } @@ -232,6 +275,49 @@ static void RetValue( void ) { LPSTR cString; +#if !defined(__BORLANDC__) + switch( RetVal.vt ) + { + case VT_BSTR: + cString = WideToAnsi( ( LPSTR ) RetVal.bstrVal ); + hb_retc( cString ); + hb_xfree( cString ); + break; + + case VT_BOOL: + hb_retl( RetVal.boolVal ); + break; + + case VT_DISPATCH: + hb_retnl( ( LONG ) RetVal.pdispVal ); + break; + + case VT_I4: + hb_retnl( ( LONG ) RetVal.iVal ); + break; + + case VT_R8: + hb_retnd( RetVal.dblVal ); + break; + + case VT_DATE: + hb_retds( DblToDate( RetVal.dblVal ) ); + break; + + case VT_EMPTY: + hb_ret(); + break; + + default: + if ( nOleError == S_OK ) + (LONG) nOleError = -1; + hb_ret(); + break; + } + + if( RetVal.vt != VT_DISPATCH ) + VariantClear( &RetVal ); +#else switch( RetVal.n1.n2.vt ) { case VT_BSTR: @@ -273,6 +359,7 @@ static void RetValue( void ) if( RetVal.n1.n2.vt != VT_DISPATCH ) VariantClear( &RetVal ); +#endif } @@ -455,7 +542,11 @@ HB_FUNC( OLEERROR ) HB_FUNC( OLEISOBJECT ) { +#if !defined(__BORLANDC__) + hb_retl( RetVal.vt == VT_DISPATCH ); +#else hb_retl( RetVal.n1.n2.vt == VT_DISPATCH ); +#endif } HB_FUNC( OLEUNINITIALIZE )