FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Dll calls, where is my mistake ?
Posts: 35
Joined: Mon Jan 19, 2009 09:14 AM

Dll calls, where is my mistake ?

Posted: Wed Jun 03, 2009 09:35 AM

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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: Dll calls, where is my mistake ?

Posted: Mon Jun 08, 2009 07:32 PM

Andrej,

Try it this way:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion