FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xHarbour builder & FWH - workaround
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xHarbour builder & FWH - workaround
Posted: Thu Aug 03, 2006 05:50 PM
There is a problem with the most recent xHarbour builder and FWH. Copy this code in your main PRG and it fixes it:
#pragma BEGINDUMP

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

typedef struct
{
   FARPROC farProc;
   BYTE bType;
   BYTE bReturn;
   BYTE bParams;
   BYTE bParam[ 15 ];
} STRFUNC;

HB_FUNC( GETPROCADDRESS )
{
   STRFUNC strFunc;
   BYTE b = 0;
   BYTE bFunc[ 4 ];

   strFunc.bParams = hb_pcount() - 4;
   
   if( ISNUM( 2 ) )
   {
      bFunc[ 0 ]      = hb_parni( 2 );
      bFunc[ 1 ]      = 0;
      strFunc.farProc = GetProcAddress( ( HMODULE ) hb_parnl( 1 ), ( LPSTR ) bFunc );
   }
   else
      strFunc.farProc = GetProcAddress( ( HMODULE ) hb_parnl( 1 ), hb_parc( 2 ) );

   strFunc.bType      = hb_parl( 3 );
   strFunc.bReturn    = hb_parni( 4 );

   while( b < strFunc.bParams )
   {
      strFunc.bParam[ b ] = hb_parni( 5 + b );
      b++;                // keep this here cause Borland 5
   }

   hb_retclen( ( char * ) &strFunc, sizeof( STRFUNC ) - 15 + strFunc.bParams );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 142
Joined: Tue Jan 24, 2006 09:45 AM
xHarbour builder &amp; FWH - workaround
Posted: Fri Aug 04, 2006 09:54 AM

Hello, sorry, me again!

I copied (cut & pasted) the temporary fix into my main .prg but when compiling I now get the following xHB error:

hbole.h Line 62 Error F0026 Parse error in constant expression '\'

Help!

Regards,

Dale.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xHarbour builder &amp; FWH - workaround
Posted: Fri Aug 04, 2006 10:08 AM

Dale,

What xHarbour builder version or RC are you using ?

Have you tried with a fresh install of xHarbour builder ? Here it works ok.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 142
Joined: Tue Jan 24, 2006 09:45 AM
xHarbour builder &amp; FWH - workaround
Posted: Fri Aug 04, 2006 10:59 AM

Hello,

I am using the latest release of XHB i.e. August 2006 RC-8.

I always uninstall my current version and re-install the new one each time a new release is made available so there is no chance that it is a corrupt installation or contains old or modified files. I do the same with FWH.

Regards,

Dale.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xHarbour builder &amp; FWH - workaround
Posted: Fri Aug 04, 2006 11:01 AM
Dale,

Please build this sample with xHB. It should build and work ok with no problems. Let us know if it works ok, thanks.
#include "FiveWin.ch"

function Main() 

   MsgInfo( GetCPU() )
   ShellExecute( 0, 'Open', 'http://www.google.com/' )
   
return nil

#pragma BEGINDUMP

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

typedef struct
{
   FARPROC farProc;
   BYTE bType;
   BYTE bReturn;
   BYTE bParams;
   BYTE bParam[ 15 ];
} STRFUNC;

HB_FUNC( GETPROCADDRESS )
{
   STRFUNC strFunc;
   BYTE b = 0;
   BYTE bFunc[ 4 ];

   strFunc.bParams = hb_pcount() - 4;
   
   if( ISNUM( 2 ) )
   {
      bFunc[ 0 ]      = hb_parni( 2 );
      bFunc[ 1 ]      = 0;
      strFunc.farProc = GetProcAddress( ( HMODULE ) hb_parnl( 1 ), ( LPSTR ) bFunc );
   }
   else
      strFunc.farProc = GetProcAddress( ( HMODULE ) hb_parnl( 1 ), hb_parc( 2 ) );

   strFunc.bType      = hb_parl( 3 );
   strFunc.bReturn    = hb_parni( 4 );

   while( b < strFunc.bParams )
   {
      strFunc.bParam[ b ] = hb_parni( 5 + b );
      b++;                // keep this here cause Borland 5
   }

   hb_retclen( ( char * ) &strFunc, sizeof( STRFUNC ) - 15 + strFunc.bParams );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xHarbour builder &amp; FWH - workaround
Posted: Fri Aug 04, 2006 10:57 PM
Dale,

There is a simpler solution. Please add these lines into FiveWin.ch:
#ifdef __XHARBOUR__
   REQUEST GetProcAddress
#endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 142
Joined: Tue Jan 24, 2006 09:45 AM
xHarbour builder &amp; FWH - workaround
Posted: Sat Aug 05, 2006 09:03 AM

Thanks very much for the help.

I tried both methods and both work perfectly - thanks.

I must apologise to you for posting the compile error. I did not realise that I had a comment before the '#pragma BEGINDUMP' statement i.e. I had '***#pragma BEGINDUMP'. Careless! Sorry about that!

Once again, thanks for the help.

Regards,

Dale.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
xHarbour builder &amp; FWH - workaround
Posted: Sat Aug 05, 2006 09:05 AM

Dale,

You are welcome. Glad to know it is working fine :)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion