VSR 0 Posted April 6, 2023 The drivers, documentation, and sample code for the Excella cheque scanner is found at https://www.magtek.com/support/excella?tab=software. I would like to connect to Excella STX Cheque scanner device to scan the cheques. I would like to connect the Device from Delphi 7 Project/ Code using the Excella API Calls they provided. I had sample code reference related to it C++ but I would like to implement the same in Delphi 7. Please see attached sample code "SampleCode_ProcessDoc.txt". Please help me. Thanks in advance SampleCode_ProcessDoc.txt Share this post Link to post
VSR 0 Posted April 6, 2023 I declared the dll call like below: const MTXMLMCR_DLL = 'MTXMLMCR.dll'; Type PDeviceType = PChar; function MTMICRGetDevice(dwDeviceContext : DWORD ; pDevName : PDeviceType): ULONG; external MTXMLMCR_DLL; //stdcall; I am trying to connect the Device by writing the code like below and I got the Access violation at the call "Result := MTMICRGetDevice(1,@DeviceName);" function TfraExcellaChequeScanner.ProcessCheque: String; var nRet : Integer; strLog,strTmp : String; begin nRet := -1; ProcessInit; nRet := SetupOptions; if (nRet <> MICR_ST_OK) then begin strLog := 'Setup Options FAILED...'; Showmessage(strLog); end else begin strLog := 'Setup Options SUCCESS...'; Showmessage(strLog); end; end; function TfraExcellaChequeScanner.SetupOptions: Integer; var DeviceName : String; PDeviceName : ^String; begin DeviceName := 'EXCELLA_USB'; PDeviceName := @DeviceName; Result := MTMICRGetDevice(1,@DeviceName); end; procedure TfraExcellaChequeScanner.ProcessInit; begin MICR_ST_OK := 1; MICR_ST_DEVICE_NOT_FOUND := 0; MICR_ST_BAD_PARAMETER := -1; end; Share this post Link to post
Fritzew 51 Posted April 6, 2023 The Documentation : #define DEVICE_NAME_LEN 128 int i=1; DWORD dwResult; char pcDevName[DEVICE_NAME_LEN]=""; while ((dwResult = MTMICRGetDevice(i,(char*) pcDevName)) != MICR_ST_DEVICE_NOT_FOUND) { // Device found, increment the device number i++; } so you van to use buffer not a String: function TfraExcellaChequeScanner.SetupOptions: Integer; var DeviceName : Array[0..127] of Char; begin Result := MTMICRGetDevice(1,@DeviceName); end; Share this post Link to post