Page 3 of 4

PostPosted: Tue Nov 21, 2006 10:21 pm
by Antonio Linares
Maurizio,

The linked functions from the LIB are forcing the DLL to get loaded when the application starts. This is automatically performed by Windows.

Re: DLL

PostPosted: Mon May 21, 2012 1:21 pm
by kok joek hoa
Dear Antonio,

Can you help to find out what is wrong with this code :

the error is statement : extern "C" {

Regards,

kok


////------------------------------------------------------------------------------------------------------------

#include "Fwce.ch"
#include "dll.ch"
#include "Struct.ch"


//catatan kode uid
// 7 6 5 4 3 2 1 0
// EO Manufacture ---------- serial number -------------
//
// kode manufacture
// 02H = ST MICROELECTRONICS "ST LRI64/LRI512"
// 04H = PHILLIPS SEMICONDUCTORS "I.CODE SLI/SL2"
// 05H = INFINEONS TECHNOLOGIES AG "Infineon My-D"
// 07H = TEXAS INSTRUMENT "Tag-It HFI"
// 16H = EM MICROELECTRONIC-MARIN SA


#define OBTN_POWER_ON 1


static nconnection
static nclose_connection
function RFID_MAIN()


local ownd
local obtn :=array(10)


nconnection := 1
nclose_connection :=1


DEFINE window ownd title 'RFID 15693'
@ 10,10 BUTTON "Connect" SIZE 90,30 OF OWND PIXEL UPDATE action fun_Connect_reader()
@ 10,130 BUTTON "Disconnect" size 90,30 OF OWND PIXEL UPDATE action fun_close_Connect_reader( )
@ 50,10 BUTTON "Open RF" SIZE 90,30 OF OWND PIXEL UPDATE action fun_openrf()
@ 50,130 BUTTON "Close RF" SIZE 90,30 OF OWND PIXEL UPDATE action fun_closerf()


ACTIVATE dialog ownd
ModulePowerOff( )

return nil

static function fun_power_on()

if ModulePowerOn()==0
msginfo('Power on sukses')
else
msgalert('Power on gagal')
endif
return nil


static function fun_Connect_reader()

fun_power_on()


if ConnectReader() == 0
msginfo('Koneksi Sukses')
fun_reader_information()
nconnection := 0
else
msgalert('Koneksi Gagal')
nconnection := 1
return nil
endif




return nil

static function fun_close_Connect_reader()

if DisConnectReader() == 0
nclose_connection := 0
else
msgalert('Tutup Koneksi Gagal')
nclose_connection := 1
endif

return nil

static function fun_openrf()
MSGINFO('NILAI OPEN RF')
MSGINFO(nAddressPort:nValue)
if openRf(nAddressPort:nValue )==0
msginfo('Open Rf Sukses')
else
msginfo('Open Rf Gagal')
endif
return nil

static function fun_closerf()

if closeRf( )==0
msginfo('Close Rf sukses')
else
msginfo('Close Rf Gagal')
endif

return nil


static function fun_reader_information()

public nAddressPort
public VersionInfo
public ReaderType
public TrType
public InventoryScanTime




STRUCT nAddressPort
MEMBER nValue AS BYTE
ENDSTRUCT


STRUCT VersionInfo
MEMBER Versionnumber AS BYTE
MEMBER Versionnumber1 AS BYTE
ENDSTRUCT

STRUCT ReaderType
MEMBER typereader AS BYTE
ENDSTRUCT

STRUCT TrType
MEMBER Type1 AS BYTE
MEMBER Type2 AS BYTE
ENDSTRUCT

STRUCT InventoryScanTime
MEMBER nValue AS BYTE
ENDSTRUCT

nAddressPort:nValue :=0xff
ReaderType:typereader :=0
InventoryScanTime:nValue :=0



msginfo(nAddressPort:nValue)
MSGINFO( GetReaderInfo ( nAddressPort:cbuffer ,;
VersionInfo:cbuffer ,;
ReaderType:cbuffer ,;
TrType:cbuffer ,;
InventoryScanTime:cbuffer ;
) ;
)




msginfo(nAddressPort:nValue)

msginfo(VersionInfo:Versionnumber)
msginfo(VersionInfo:Versionnumber1)

msginfo( ReaderType:typereader )
//se
//msginfo('info gagal')
//dif

return nil



DLL STATIC FUNCTION ModulePowerOn( ) AS LONG PASCAL FROM "ModulePowerOn" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION ModulePowerOff( ) AS LONG PASCAL FROM "ModulePowerOn" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION ConnectReader( ) AS LONG PASCAL FROM "ConnectReader" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION DisConnectReader( ) AS LONG PASCAL FROM "DisConnectReader" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION OpenRf( ComAdr AS LPSTR) AS LONG PASCAL FROM "OpenRf" LIB "RR3WinCe.dll"
DLL STATIC FUNCTION CloseRf(ComAdr AS LPSTR) AS LONG PASCAL FROM "CloseRf" LIB "RR3WinCe.dll"

/* DLL STATIC FUNCTION GetReaderInfo( @ComAdr AS LPSTR ,;
@VersionInfo AS LPSTR ,;
@ReaderType AS LPSTR ,;
@TrType AS LPSTR ,;
@InventoryScanTime AS LPSTR ;
) AS LONG PASCAL FROM "GetReaderInfo" LIB "RR3WinCe.dll" */



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

extern "C" {
LONG GetReaderInfo( LPSTR ,LPSTR ,LPSTR ,LPSTR ,LPSTR ) ;
}

HB_FUNC(GETREADERINFO)
{
hb_retnl(GetReaderInfo(hb_parc(1),hb_parc(2),hb_parc(3),hb_parc(4),hb_parc(5))) ;
}

#pragma ENDDUMP

Re: DLL

PostPosted: Thu May 24, 2012 7:49 am
by kok joek hoa
Hi All,

please, anyone can help me?

Regards,

Kok

Re: DLL

PostPosted: Thu May 24, 2012 8:33 am
by Antonio Linares
Kok,

You can only use extern "C" when you are compiling a C++ file or in C++ mode.

Simply remove those lines:

LONG GetReaderInfo( LPSTR ,LPSTR ,LPSTR ,LPSTR ,LPSTR ) ;

HB_FUNC(GETREADERINFO)
{
hb_retnl(GetReaderInfo(hb_parc(1),hb_parc(2),hb_parc(3),hb_parc(4),hb_parc(5))) ;
}

Re: DLL

PostPosted: Thu May 24, 2012 8:39 am
by kok joek hoa
Hi Antonio,

After remove as you suggest ,

this warning is appear :

RFID156.PRG (209) Warning C4013 : 'GetReaderInfo',undetifined, assuming extern returning int


Regards,

Kok

Re: DLL

PostPosted: Thu May 24, 2012 8:42 am
by kok joek hoa
Hi Antonio,

sorry , this error is appear :


ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for Pocket PC - February 2010 Harbour development power ³Ü
³ (c) FiveTech Software, 1993-2010 for Microsoft Windows Pocket PC ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
rfid156.c
rfid156.prg(209) : warning C4090: 'function' : different 'const' qualifiers
rfid156.prg(209) : warning C4024: 'GetReaderInfo' : different types for formal and actual parameter 1
rfid156.prg(209) : warning C4090: 'function' : different 'const' qualifiers
rfid156.prg(209) : warning C4024: 'GetReaderInfo' : different types for formal and actual parameter 2
rfid156.prg(209) : warning C4090: 'function' : different 'const' qualifiers
rfid156.prg(209) : warning C4024: 'GetReaderInfo' : different types for formal and actual parameter 3
rfid156.prg(209) : warning C4090: 'function' : different 'const' qualifiers
rfid156.prg(209) : warning C4024: 'GetReaderInfo' : different types for formal and actual parameter 4
rfid156.prg(209) : warning C4090: 'function' : different 'const' qualifiers
rfid156.prg(209) : warning C4024: 'GetReaderInfo' : different types for formal and actual parameter 5
* Application successfully built *
1 file(s) copied.


Regards,

Kok

Re: DLL

PostPosted: Thu May 24, 2012 8:47 am
by Antonio Linares
Kok,

Change it this way:

hb_retnl( GetReaderInfo( ( char * ) hb_parc(1), ( char * ) hb_parc(2), ( char * ) hb_parc(3), ( char * ) hb_parc(4), ( char * ) hb_parc(5) ) );

Re: DLL

PostPosted: Thu May 24, 2012 8:52 am
by kok joek hoa
Dear Antonio,

Thank you for your help, the warning is disappear, I will try it with my handheld rfid and let you know later.

regards,

Kok

Re: DLL

PostPosted: Thu May 24, 2012 9:16 am
by kok joek hoa
Dear Antonio,

how I can get the return value from hb_parc(1) , hb_parc(2) , hb_parc(3) , hb_parc(4) , hb_parc(5) ?

regards,

kok

Re: DLL

PostPosted: Thu May 24, 2012 12:57 pm
by kok joek hoa
Hi Antonio,

with below code , GetreaderInfo return 0 ( this is right) , but how i can get the ComAdr ,VersionInfo,ReaderType,TrType and
InventoryScanTime value ?

regards,

kok

Code: Select all  Expand view

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


LONG GetReaderInfo( LPSTR ,LPSTR ,LPSTR ,LPSTR ,LPSTR ) ;

LPWSTR AnsiToWide( LPSTR );

HB_FUNC(GETREADERINFO)
{
LPWSTR ComAdr               =   AnsiToWide( (char *) hb_parc( 1 ) );
LPWSTR VersionInfo          =   AnsiToWide( (char *) hb_parc( 2 ) );
LPWSTR ReaderType           =   AnsiToWide( (char *) hb_parc( 3 ) );
LPWSTR TrType               =   AnsiToWide( (char *) hb_parc( 4 ) );
LPWSTR InventoryScanTime    =   AnsiToWide( (char *) hb_parc( 5 ) );


hb_retnl( GetReaderInfo( ( char * ) ComAdr, ( char * )  VersionInfo, ( char * )  ReaderType , ( char * )  TrType, ( char * )  InventoryScanTime) );

hb_xfree (ComAdr);
hb_xfree (VersionInfo);
hb_xfree (ReaderType);
hb_xfree (TrType);
hb_xfree (InventoryScanTime);

}


#pragma ENDDUMP  
 

Re: DLL

PostPosted: Thu May 24, 2012 2:55 pm
by Antonio Linares
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>

LONG GetReaderInfo( LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ,LPWSTR ) ;

LPWSTR AnsiToWide( LPSTR );

HB_FUNC( GETREADERINFO )
{
LPWSTR ComAdr = AnsiToWide( (char *) hb_parc( 1 ) );
LPWSTR VersionInfo = AnsiToWide( (char *) hb_parc( 2 ) );
LPWSTR ReaderType = AnsiToWide( (char *) hb_parc( 3 ) );
LPWSTR TrType = AnsiToWide( (char *) hb_parc( 4 ) );
LPWSTR InventoryScanTime = AnsiToWide( (char *) hb_parc( 5 ) );
LPSTR p1, p2, p3, p4, p5;

GetReaderInfo( ComAdr, VersionInfo, ReaderType, TrType, InventoryScanTime );

p1 = WideToAnsi( ComAdr );
p2 = WideToAnsi( VersionInfo );
p3 = WideToAnsi( ReaderType );
p4 = WideToAnsi( TrType );
p5 = WideToAnsi( InventoryScanTime );

hb_reta( 5 );
hb_storc( p1, -1, 1 );
hb_storc( p2, -1, 2 );
hb_storc( p3, -1, 3 );
hb_storc( p4, -1, 4 );
hb_storc( p5, -1, 5 );

hb_xfree( ComAdr );
hb_xfree( VersionInfo );
hb_xfree( ReaderType );
hb_xfree( TrType );
hb_xfree( InventoryScanTime );

hb_xfree( p1 );
hb_xfree( p2 );
hb_xfree( p3 );
hb_xfree( p4 );
hb_xfree( p5 );
}

#pragma ENDDUMP

Re: DLL

PostPosted: Thu May 24, 2012 4:32 pm
by kok joek hoa
Hi Antonio,

Thank you for your help, but still error :

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for Pocket PC - February 2010 Harbour development power ³Ü
³ (c) FiveTech Software, 1993-2010 for Microsoft Windows Pocket PC ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
rfid156.c
rfid156.prg(216) : warning C4013: 'WideToAnsi' undefined; assuming extern returning int
rfid156.prg(216) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
rfid156.prg(217) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
rfid156.prg(218) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
rfid156.prg(219) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
rfid156.prg(220) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int '
rfid156.prg(223) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(224) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(225) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(226) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(227) : warning C4020: 'hb_storc' : too many actual parameters
* Application successfully built *
1 file(s) copied.

regards,

kok

Re: DLL

PostPosted: Thu May 24, 2012 6:43 pm
by Antonio Linares
Kok,

I forgot to include this declaration at the header:

LPSTR WideToAnsi( LPWSTR );

Re: DLL

PostPosted: Fri May 25, 2012 4:41 am
by kok joek hoa
Dear Antonio,

still error :


ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ FiveWin for Pocket PC - February 2010 Harbour development power ³Ü
³ (c) FiveTech Software, 1993-2010 for Microsoft Windows Pocket PC ³Û
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Compiling...
rfid156.c
rfid156.prg(224) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(225) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(226) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(227) : warning C4020: 'hb_storc' : too many actual parameters
rfid156.prg(228) : warning C4020: 'hb_storc' : too many actual parameters
* Application successfully built *
1 file(s) copied.

regards,

Kok

Re: DLL

PostPosted: Fri May 25, 2012 9:40 am
by Antonio Linares
Kok,

Those are warnings that you can safely ignore

Is the function call working fine ? Do you get an array with the requested info ?