Page 1 of 1

Dll calls, where is my mistake ?

PostPosted: Wed Jun 03, 2009 9:35 am
by xVar
I try use dll calls in my FWPPC application. But I confused ... (I havn't strong C knowledge)
I want open Motorola RFID reader. Reader has dll for handle RFID cals

//
Dll Name:RFIDAPI32.dll
File Location:\windows\rfidapi32.dll
//

Is a functions.
DWORD WINAPI RFID_Open(HANDLE *phReader);
DWORD WINAPI RFID_Close(HANDLE *phReader);

It is example (c++):

//

HANDLE hRFIDReader;
if(RFID_Open(&HRFIDReader) == RFID_SUCCESS)
{
RFID_Close(&hRFIDReader);
}

//

RFID_SUCCESS 0 Function succeeded.
RFID_INVALID_HANDLE 17 Invalid device handle provided.


I declare this functions in my application:

//

DLL FUNCTION RFID_Open(@hRFIDReader as PTR ) ;
AS DWORD LIB "rfidapi32.dll"

DLL FUNCTION RFID_Close(@hRFIDReader as PTR ) ;
AS DWORD LIB "rfidapi32.dll"
//



And run next code.



//-------------------------------------------------------------------------//
Function RunUdlTags()
//-------------------------------------------------------------------------//
Local nHandle:=0
Local nRet
nRet:=RFID_Open(@nHandle)
MsgInfo(str(nRet))
RFID_Close(@nHandle)
Return Nil

RDID_Open always return 17 - invalid device handle.

Is possible that I make mistake in DLL Functions declaration ?


If I call this function in this way

HB_FUNC(OPEN_RFID)
{

nStatus=RFID_Open(&hReader);
if(nStatus == RFID_SUCCESS)
{
}
hb_retnl( (LONG) hReader );
}

is work fine.


Best regards

Andrej

Re: Dll calls, where is my mistake ?

PostPosted: Mon Jun 08, 2009 7:32 pm
by Antonio Linares
Andrej,

Try it this way:

DLL FUNCTION RFID_Open(@hRFIDReader as LONG ) ;
AS DWORD LIB "rfidapi32.dll"