تسجيل الدخول

مشاهدة النسخة كاملة : using a third party dll



C++ Programming
05-27-2009, 11:41 AM
I have a piece of hardware (cash dispenser) that I'm trying to control with a PC. It comes with a Dll, but for the life of me I can't figure out how to use the dll. can someone please help me get started on this? It does have a manual with the dll describing the functions, but it is almost unintelligible.

Here is some of the supplied literature, if it helps to answer the question

2.1.1 EVENT

During ezLink protocol is handling, ezLink.dll notice protocol status to application program to create WM_USER_EZCDM_RECEIVE event as below

WPARAM CODE COMMENT
EVENT_RECV_RESPONSE 00001000H RESPONSE receiving
EVENT_SEND_RETRYOVER 00001001H COMMAND sending failure
EVENT_RECV_RETRYOVER 00001002H RESPONSE receiving failure

WM_USER_EZCDM_RECEIVE event is defined as follows.

#define WM_USER_EZCDM_RECEIVE (WM_USER+301)

If EVENT_RECV_RESPONSE is generated, AP must receive Response to call the ezLinkRcv() function.

2.1.2 Recording Log Data

ezLink.dll record LOG as below format. Recorded LOG FILE ******** is directory folder to be transmitted ezLinkPath(). LOG is recorded whenever DLL function is called.


FILE NAME: (Generating File date (year month date) + ezCDM.txt) ex) 20060206ezCDM.txt
FILE Generating Folder: selected folder path in the ezLinkPath() parameter.


2.2 DLL FUNCTION

2.2.1 ezLinkOpen

ezLinkOpen Loads the DLL and opens the communication port.

Syntax EZLINK_DLL_API UINT ezLinkOpen(SETINFO *pSetInfo);

Parameters

pSetInfo Structure with information to communicate with dll

typedef struct
{
unsigned char uiPort; //communication port
unsigned char ucDataBits; //Data bit
unsigned char ucParity; //Parity bit
unsigned char ucStopBits; //Stop bit
unsigned long dwBaudRate; //Baud Rate
HWND hwnd; //Parent window handle
unsigned char ucCommandType; //command type(1: ezCDM-1000 )
}SETINFO

Return Values
EZLINK_SUCCESS Open port success

Remarks
If DLL opens ezCDM Communication-port successfully, returns the EZLINK_SUCCESS.









2.2.2 ezLinkClose

ezLinkClose Closes the Communication Port.

Syntax EZLINK_DLL_API UINT ezLinkClose(void);

Parameters
None

Return Values

EZLINK_SUCCESS Close port success

Remarks

If DLL closes ezCDM communication-port successfully, returns EZLINK_SUCCESS.