ActiveX Equivalentes de funciones FoxPro en Fivewin

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Antonio Linares » Tue Nov 26, 2024 11:17 pm

Otro intento que aún sigue fallando:

Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

    local oShell := CreateObject( "Shell.Application" )
    local oInterface := GetInterface( oShell, "{000214D0-0000-0000-C000-000000000046}" ) // "IShellDispatch"

    ? oInterface:ClassName

return nil    

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>
#include <hbstack.h>

IDispatch * hb_oleItemGet( PHB_ITEM pItem );
PHB_ITEM hb_oleItemPut( PHB_ITEM pItem, IDispatch * pDisp );

static wchar_t * AnsiToWide( const char * szString )
{
   int       iLen;
   wchar_t * szWide;

   iLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, NULL, 0 );
   szWide = ( wchar_t* ) hb_xgrab( iLen * sizeof( wchar_t ) );
   MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, szWide, iLen );
   return szWide;
}

HB_FUNC( GETINTERFACE )
{
   IDispatch * pDisp = hb_oleItemGet( hb_param( 1, HB_IT_ANY ) );
   IID riid;
   IDispatch * pInterface = NULL;
   wchar_t * cIID = AnsiToWide( hb_parc( 2 ) );

   if( IIDFromString( ( LPOLESTR ) cIID, &riid ) == S_OK )
   {
      MessageBox( 0, "ok", "ok", 0 );
      if( pDisp->lpVtbl->QueryInterface( pDisp, &riid, ( void** ) &pInterface ) == S_OK )
      {
         hb_oleItemPut( hb_stackReturnItem(), pInterface );
      }
   }

   hb_xfree( cIID );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby Antonio Linares » Tue Nov 26, 2024 11:20 pm

Tercer intento, sigue sin funcionar:

Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

    local oShell := CreateObject( "Shell.Application" )
    local oInterface := GetInterface( oShell:__hObj, "{000214D0-0000-0000-C000-000000000046}" ) // "IShellDispatch"

    ? oInterface:ClassName

return nil    

#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>
#include <hbstack.h>

IDispatch * hb_oleItemGet( PHB_ITEM pItem );
PHB_ITEM hb_oleItemPut( PHB_ITEM pItem, IDispatch * pDisp );

static wchar_t * AnsiToWide( const char * szString )
{
   int       iLen;
   wchar_t * szWide;

   iLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, NULL, 0 );
   szWide = ( wchar_t* ) hb_xgrab( iLen * sizeof( wchar_t ) );
   MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, szWide, iLen );
   return szWide;
}

HB_FUNC( GETINTERFACE )
{
   IDispatch * pDisp = hb_oleItemGet( hb_param( 1, HB_IT_ANY ) );
   IID riid;
   IDispatch * pInterface = NULL;
   wchar_t * cIID = AnsiToWide( hb_parc( 2 ) );

   if( IIDFromString( ( LPOLESTR ) cIID, &riid ) == S_OK )
   {
      MessageBox( 0, "1", "1", 0 );
      if( pDisp->lpVtbl->QueryInterface( pDisp, &riid, ( void** ) &pInterface ) == S_OK )
      {
        MessageBox( 0, "2", "2", 0 );
        hb_oleItemPut( hb_stackReturnItem(), pInterface );
      }
   }

   hb_xfree( cIID );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby sysctrl2 » Wed Nov 27, 2024 12:36 am

Gracias Antonio,
te necesitamos para poder dar el salto !!!
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 1032
Joined: Mon Feb 05, 2007 7:15 pm

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Postby albeiroval » Wed Nov 27, 2024 2:18 am

sysctrl2 wrote:Gracias Antonio,
te necesitamos para poder dar el salto !!!


Por supuesto Cesar, estamos a la expectativa
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
albeiroval
 
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 54 guests