Antonio Linares
Site Admin
Posts: 42406 Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 48 times
Contact:
Post
by Antonio Linares » Thu Aug 03, 2006 5: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:
Code: Select all | Expand
#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
dpaterso
Posts: 142 Joined: Tue Jan 24, 2006 9:45 am
Location: South Africa
Contact:
Post
by dpaterso » Fri Aug 04, 2006 9: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.
Antonio Linares
Site Admin
Posts: 42406 Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 48 times
Contact:
Post
by Antonio Linares » 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.
dpaterso
Posts: 142 Joined: Tue Jan 24, 2006 9:45 am
Location: South Africa
Contact:
Post
by dpaterso » 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.
Antonio Linares
Site Admin
Posts: 42406 Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 48 times
Contact:
Post
by Antonio Linares » 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.
Code: Select all | Expand
#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
dpaterso
Posts: 142 Joined: Tue Jan 24, 2006 9:45 am
Location: South Africa
Contact:
Post
by dpaterso » Sat Aug 05, 2006 9: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.