ActXEvents

ActXEvents

Postby Jimmy » Sun Dec 15, 2019 11:28 pm

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
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: ActXEvents

Postby Antonio Linares » Mon Dec 16, 2019 8:58 am

Code: Select all  Expand view  RUN
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
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ActXEvents

Postby Jimmy » Mon Dec 16, 2019 9:46 pm

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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 70 guests