On Thu, 14 May 2009, Pritpal Bedi wrote:

Hi,

> Mindaugas Kavaliauskas wrote:
> > We will to change at least numeric type to pointer type...
> Yes, but how. I am following your code but am been 
> unbale to hook any code inside it because of WINAPI background.
> harbour/contrib/gtwvg/wvgsink.c
>    AtlAxCreateControl = ( PATLAXCREATECONTROL ) GetProcAddress( hLib,
> "AtlAxCreateControl" );
>    if ( AtlAxCreateControl )
>    {
>       hContainer = ( HWND ) CreateWindowEx( Exstyle, cClass, TEXT(""),
> Style, x, y, w, h,
>                                             hParent, id, GetModuleHandle(
> NULL ), NULL );
>       if( hContainer )
>       {
>          ...
>          ...
>          ( AtlAxCreateControl ) ( wString, hContainer, NULL, &pUnk );
>          if( pUnk )
>          {
>             pUnk->lpVtbl->QueryInterface( pUnk, HB_ID_REF( IID_IDispatch ),
> ( void** ) (void*) &obj );
>             pUnk->lpVtbl->Release( pUnk );
>             hb_retnint( ( HB_PTRDIFF ) obj ); 
>             ^^^^^^^^^^^^^^^^^^^^
> This code returns a obj as a numeric handle which in turn 
> is used to initialize TOleAuto() for handelling messages.
> If we can either change this code or olecore implementation
> then we can come close of two implementations.

It's enough to add to olecore.c this function:

PHB_ITEM hb_oleItemPut( PHB_ITEM pItem, IDispatch* pDisp )
{
   IDispatch** ppDisp;

   ppDisp = ( IDispatch** ) hb_gcAlloc( sizeof( IDispatch* ), hb_ole_destructor 
);
   *ppDisp = pDisp;

   return hb_itemPutPtrGC( pItem, ppDisp );
}

It should be declared as public C function in hbwinole.h.
Then you use it to create Harbour GC pointer item and return it instead
of hb_retint(), f.e.:

   hb_itemReturnRelease( hb_oleItemPut( NULL, obj ) );

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to