ActXEvents

Post Reply
User avatar
Jimmy
Posts: 165
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

ActXEvents

Post by Jimmy »

hi,

i try some ActiveX Sample and saw CLASS TActiveX in c:\fwh\source\classes\activex.prg
there is a Function ActXEvents() but i can't find it :?
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ActXEvents

Post by Antonio Linares »

Code: Select all

HB_FUNC( ACTXEVENTS )
{
   LPWSTR pW = AnsiToWide( ( char * ) hb_parc( 1 ) );
   ITypeInfo * ptinfo;
   ITypeLib * ptlib;
   IUnknown * pUnk = hb_oleParam( 2 );
   IProvideClassInfo2 * ppci2;
   GUID guid;
   
   if( LoadTypeLib( pW, &ptlib ) != S_OK )
   {    
      hb_xfree( pW );
      return;
   }
   else
      hb_xfree( pW );        
   
   if( ! pUnk->QueryInterface( IID_IProvideClassInfo2,
                               ( void ** ) &ppci2 ) == S_OK )
      return;
   
   ppci2->GetGUID( GUIDKIND_DEFAULT_SOURCE_DISP_IID, &guid );
   ppci2->Release();
   
   if( ptlib->GetTypeInfoOfGuid( guid, &ptinfo ) == S_OK )
   {    
      FUNCDESC * pfdesc;
      BSTR bsName;
      LPSTR cName;
      LPWSTR pW2;
      TYPEATTR * ptattr;
      
      ptinfo->GetTypeAttr( &ptattr );

      hb_reta( 0 ); 

      for( WORD w = 0; w < ptattr->cFuncs; w++ )
      {
         PHB_ITEM pSubarray = hb_itemArrayNew( 2 );
         PHB_ITEM pName, pItem;
         
         ptinfo->GetFuncDesc( w, &pfdesc );     
         ptinfo->GetDocumentation( pfdesc->memid, &bsName, NULL, NULL, NULL );
         cName = WideToAnsi( bsName );
         hb_arraySet( pSubarray, 1, hb_itemPutC( NULL, cName ) );
         hb_arraySet( pSubarray, 2, hb_itemPutNL( NULL, pfdesc->memid ) );
         hb_arrayAdd( hb_param( -1, HB_IT_ANY ), pSubarray );
         hb_xfree( cName );
         ptinfo->ReleaseFuncDesc( pfdesc );
         hb_itemRelease( pSubarray ); 
      }  
   }
   else
      MessageBox( 0, "can't read types from ActiveX", "error", 0 );  
}   
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 165
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: ActXEvents

Post by Jimmy »

hi,

THX very much :D

that was what i miss in ot4xb "AtlAxWin" CLASS.
i will try to implement it and hope i can use it with Xbase++ while AX & Co is running in different Thread.
greeting,
Jimmy
Post Reply