Im trying to read the data from a magnetic card reader its model is MT188. The Card reader comes with a DLL and a doc for the functions in the DLL. the process to read a card is as follows.
HANDLE APIENTRY CommOpenWithBaut(UINT nPort, UINT _data)
open serial Communications example : CommOpenWithBaut(1,9600);.
int APIENTRY CarderCheckSt(HANDLE hComHandle, unsigned char &PewSt, unsigned char &CardType, unsigned char &CardSt, unsigned char &PowerSt)
check Device status.
int APIENTRY MagRead(HANDLE hComHandle,BYTE *MagData,int &lenth)
read Magnetic card data
int APIENTRY CommClose(HANDLE hComHandle);
Close port after the card is read.
Each function has a return value. This is an example of the cout<<Magread<<endl;
is gives a value of 00007FF792E41258
. What am I doing wrong? How can I use these functions the right way?
here is my main.
int main(int arg, char* argc[])
{
CommOpenWithBaut(1,9600);
cout<< "This is the cards data: " << MagRead << endl;
cout << "This is the cards status: " << CarderCheckSt << endl;
CommClose;
}
updates:
I receive this error when I try to run the program:
LNK2019 unresolved external symbol "__declspec(dllimport) void * __cdecl CommOpenWithBaut(unsigned int,unsigned int)" (__imp_?CommOpenWithBaut@@YAPEAXII@Z) referenced in function main
This is my header file:
#include <iostream>
#include <windows.h>
#ifdef Modulev188_EXPORTS
#define Modulev188_API __declspec(dllexport)
#else
#define Modulev188_API __declspec(dllimport)
#endif
Modulev188_API HANDLE CommOpenWithBaut(UINT nPort, UINT _data);
Modulev188_API int CommClose(HANDLE hComHandle);
Modulev188_API int CarderCheckSt(HANDLE hComHandle, unsigned char& PewSt, unsigned char& CardType, unsigned char& CardSt, unsigned char& PowerSt);
Modulev188_API int CarderVersion(HANDLE hComHandle, unsigned char* VersionNo, int& lenth);
//DLLEXPORT int WINAPI ContactCPU_ColdReset(HANDLE hComHandle, BYTE* _CPUTYPE, BYTE* _exData, int* _exdataLen);
//DLLEXPORT int WINAPI ContactCPU_Dormancy(HANDLE hComHandle);
Modulev188_API int ContactCPU_CAPDU(HANDLE hComHandle, int _dataLen, BYTE* _APDUData, BYTE* _exData, int* _exdataLen);
Modulev188_API int SIM_Reset(HANDLE hComHandle, BYTE _VOLTAGE, BYTE _SIMNo, BYTE& _SIMTYPE, BYTE* _exData, int& _exdataLen);
Modulev188_API int SIM_C_APDU(HANDLE hComHandle, BYTE SIMNo, int _dataLen, BYTE* _APDUData, BYTE* _exData, int& _exdataLen);
Modulev188_API int SIM_CardClose(HANDLE hComHandle);
Modulev188_API int MagRead(HANDLE hComHandle, BYTE* MagData, int& lenth);
Modulev188_API int MagCleaner(HANDLE hComHandle);