Hello Pritpul,
I've put my hands a to change gtwvg to be compatible with OLE
implementation, but I'm unable to test changes. Does anyone have gtwvg
sample with working (or GPFing) ActiveX controls. I've tried to use
contrib/gtwvg/tests samples. They do not give any error, but demowvg
window is not redrawn also. Usage of pointers to store IDispatch* values
does not changes anything, i.e. no GPF's, no error, but window is not
redrawn. I'm not sure I have installed required ActiveX controls...
More comments about gtwvg state required.
Which prg did you use for test?
Both.
If you were using demoxbp.prg then main window itself hosts
activex so you may not reach to any consclusion.
The middle part of mail window is not redrawn, but I get no error.
Can you drop me what changed did you made to test it?
Here it is:
Index: C:/harboursvn/contrib/gtwvg/wvgax.prg
===================================================================
--- C:/harboursvn/contrib/gtwvg/wvgax.prg (revision 11075)
+++ C:/harboursvn/contrib/gtwvg/wvgax.prg (working copy)
@@ -155,7 +155,7 @@
::CLSID := cCLSID
::license := cLicense
- ::hObj := 0
+ ::hObj := NIL
::hSink := 0
::hContainer := ::oParent:getHWND()
@@ -177,19 +177,19 @@
::aPos[ 1 ], ::aPos[ 2 ], ::aSize[
1 ], ::aSize[ 2 ], ;
::style, ::exStyle, NIL, @hx, @pUnk )
#endif
- if ::hObj == 0
+ if EMPTY( ::hObj )
Return NIL
endif
/* Required as to AddRef() to self */
- TOleAuto():New( ::hObj )
+ /* TOleAuto():New( ::hObj ) Collectible pointers do the job */
::oParent:addChild( SELF )
::hWnd := hx
HB_AX_AtlSetVerb( ::hWnd, pUnk, -4 )
- IF ::hObj <> 0 .AND. !Empty( ::hEvents )
+ IF ! EMPTY( ::hObj ) .AND. !Empty( ::hEvents )
::AdviseEvents()
ENDIF
@@ -223,7 +223,7 @@
BEGIN SEQUENCE
- IF hb_IsNumeric( ::hObj ) .and. ::hObj <> 0
+ IF ! EMPTY( ::hObj )
IF Win_IsWindow( ::hWnd )
Win_DestroyWindow( ::hWnd )
===================================================================
Index: C:/harboursvn/contrib/gtwvg/wvgsink.c
===================================================================
--- C:/harboursvn/contrib/gtwvg/wvgsink.c (revision 11075)
+++ C:/harboursvn/contrib/gtwvg/wvgsink.c (working copy)
@@ -101,6 +101,7 @@
#include "hbvm.h"
#include "hbstack.h"
#include "hbthread.h"
+#include "..\hbwin\hbwinole.h"
#include <shlobj.h>
#include <objbase.h>
@@ -111,7 +112,7 @@
#include <ole2.h>
#include <oleauto.h>
-
+/*
#if defined( __cplusplus ) && \
( defined( __BORLANDC__ ) || defined( _MSC_VER ) || \
( defined(__WATCOMC__) && ( __WATCOMC__ >= 1280 ) ) )
@@ -120,6 +121,8 @@
# define HB_ID_REF( id ) ( &(id) )
#endif
+*/
+
/*----------------------------------------------------------------------*/
#if defined(__BORLANDC__) && !defined(HB_ARCH_64BIT)
@@ -139,10 +142,7 @@
typedef HRESULT ( CALLBACK *PATLAXCREATECONTROL )( LPCOLESTR, HWND,
IStream*, IUnknown** );
typedef HRESULT ( CALLBACK *PATLAXCREATECONTROLEX )( LPCOLESTR, HWND,
IStream*, IUnknown**, IUnknown**, REFIID, IUnknown* );
/*----------------------------------------------------------------------*/
-HB_EXPORT void hb_oleItemToVariant( VARIANT *pVariant, PHB_ITEM pItem );
-HRESULT hb_oleVariantToItem( PHB_ITEM pItem, VARIANT *pVariant );
-
/* Switch it on when required tracing. While committing switch it off */
#if 0
#define __HBTOOUT__
@@ -707,7 +707,7 @@
LPIID riid = ( LPIID ) &IID_IDispatch;
int n = 0;
- hr = SetupConnectionPoint( ( device_interface* ) ( HB_PTRDIFF )
hb_parnint( 1 ), ( REFIID ) riid, ( void** ) (void*) &hSink, &n ) ;
+ hr = SetupConnectionPoint( ( device_interface* ) hb_oleParam( 1 ), (
REFIID ) riid, ( void** ) (void*) &hSink, &n ) ;
hSink->pEvents = hb_itemNew( hb_param( 4, HB_IT_ANY ) );
@@ -881,7 +881,7 @@
{
pUnk->lpVtbl->QueryInterface( pUnk, HB_ID_REF(
IID_IDispatch ), ( void** ) (void*) &obj );
pUnk->lpVtbl->Release( pUnk );
- hb_retnint( ( HB_PTRDIFF ) obj );
+ hb_itemReturnRelease( hb_oleItemPut( NULL, obj ) );
#if 0
{
@@ -898,7 +898,7 @@
pUnkCtrl->lpVtbl->QueryInterface( pUnkCtrl, HB_ID_REF(
IID_IDispatch ), ( void** ) (void*) &obj );
pUnkCtrl->lpVtbl->Release( pUnkCtrl );
- hb_retnint( ( long ) obj );
+ hb_itemReturnRelease( hb_oleItemPut( NULL, obj ) );
GetClientRect( hContainer, &rc );
MoveWindow( GetDlgItem( hContainer, ( int ) id ), 0, 0,
rc.right-rc.left, rc.bottom-rc.top, TRUE );
@@ -906,17 +906,17 @@
#endif
else
{
- hb_retnint( 0 );
+ hb_ret();
}
}
else
{
- hb_retnint( 0 );
+ hb_ret();
}
}
else
{
- hb_retnint( 0 );
+ hb_ret();
}
/* return the container handle */
===================================================================
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour