Jeff,
I am not showing a[99], my code shows a[0].
In C language arrays are zero based, not 1 based, like in Clipper
Jeff,
I am not showing a[99], my code shows a[0].
In C language arrays are zero based, not 1 based, like in Clipper
Considering that a long value uses four bytes, then you could inspect a[99] using SubStr( oStruct:cData, 99 * 4, 4 ).
Please also try 98 * 4 and 100 * 4
Antonio,
Ok, I am lost. I really don't understand how we are connecting to this dll.
I guess my main question is ... are we accessing the dll correctly and getting the correct response ?
I don't want to spend $129.00 if it will not work with Fivewin
Thanks,
Jeff
Jeff,
The DLL expects an array of 128 long numbers (a long number uses 4 bytes = 32 bits).
Instead of using 128 struct members, we are using one single string that has 128 * 4 bytes.
The DLL is being accessed as the MessageBox() is shown, though they show a [99], and according to our test they are changing the first long (SubStr( oStruct:cData, 1, 4 ) ) of the array, not the 99.
Could you please ask them about this ? Could they confirm you that they are modifying the 99 element of the array instead of the first one ?
Hi Antonio,
Here is the reply:
Yes, in the DLL we change a[99] only, a[0] remains the same.
We've compiled a test application (using the code from our C.txt sample), and placed this to the TestDLL.zip at the same address, please download it.
By this application you can set a[0] value before the DLL function call ( = 0 by default), click the button to call DLL, and then see both a[0] and a[99] result values.
If a[0] is equal to 0, a[1] = 1 ... a[127] = 127 before the function call, after the function call a[99] would be equal to 8300.
#include "FiveWin.ch"
function Main()
local cArray := FillArray()
MsgInfo( A99( cArray ) )
TestFunc1( cArray )
MsgInfo( A99( cArray ) )
return nil
DLL FUNCTION TESTFUNC1( pValues AS LPSTR ) AS BOOL PASCAL ;
FROM "TestFunc1" LIB "TestLib12.dll"
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
HB_FUNC( FILLARRAY )
{
LONG a[ 128 ];
int i;
for( i = 0; i < 128; i++ )
a[ i ] = i;
hb_retclen( ( char * ) a, 128 * sizeof( LONG ) );
}
HB_FUNC( A99 )
{
LONG * a = ( LONG * ) hb_parc( 1 );
hb_retnl( a[ 99 ] );
}
#pragma ENDDUMPThanks for all the help Antonio.
I am going to buy the software today.
I will let you know you well it works.
Jeff
Jeff,
You are welcome,
IMO it will work fine ![]()