Dll calls, where is my mistake ?

Post Reply
xVar
Posts: 35
Joined: Mon Jan 19, 2009 9:14 am

Dll calls, where is my mistake ?

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Dll calls, where is my mistake ?

Post by Antonio Linares »

Andrej,

Try it this way:

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

Antonio Linares
www.fivetechsoft.com
Post Reply