ActiveX Equivalentes de funciones FoxPro en Fivewin

User avatar
Antonio Linares
Site Admin
Posts: 42259
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Post by Antonio Linares »

Otro intento que aún sigue fallando:

Code: Select all | Expand

#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: 42259
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Post by Antonio Linares »

Tercer intento, sigue sin funcionar:

Code: Select all | Expand

#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
sysctrl2
Posts: 1035
Joined: Mon Feb 05, 2007 7:15 pm
Contact:

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Post by sysctrl2 »

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

' Sin +- FWH es mejor "
User avatar
albeiroval
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ActiveX Equivalentes de funciones FoxPro en Fivewin

Post by albeiroval »

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
Post Reply