Dll calls, where is my mistake ?

Dll calls, where is my mistake ?

Postby xVar » Wed Jun 03, 2009 9: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
xVar
 
Posts: 35
Joined: Mon Jan 19, 2009 9:14 am

Re: Dll calls, where is my mistake ?

Postby Antonio Linares » Mon Jun 08, 2009 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41289
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 2 guests