[ad_1]
やあ、
Windows アプリケーションで Magtek Excella デバイス dll の実装に取り組んだ人はいますか?
MTMICRProcessCheck() メソッドを使用して、一度に n 個のチェックを処理しようとしています。
私の設定オプションでは、DocFeed を AUTOFEED のままにしていますが、処理には 2 回のチェックが必要で、n 個のチェックは必要ありません。
私の結果として、最初にスキャンされたチェックのみの情報を持つ XML 文字列を取得します。
誰かが同じことを実装している場合は、親切に助けてください!
解決策 1
ここに私のコードがあります、参考までに
C#
public string ProcessDocument() { string Output = string.Empty; int Count = 2; string[] strData = null; try { int nRet = -1; string strLog; string strTmp; MessageBox.Show("ProcessInit Start"); ProcessInit(); // Initialisation MessageBox.Show("SetupOptions Start"); nRet = SetupOptions(); //Setup if (nRet != MICR_ST_OK) { strLog = "Setup Options FAILED..."; MessageBox.Show(strLog); } else { strLog = "Setup Options SUCCESS..."; MessageBox.Show(strLog); StringBuilder strResponse = new StringBuilder(); strResponse.Capacity = 8192; //8192; int nResponseLength = 8192;//= 4096; m_strDocInfo = ""; nRet = MTMICRProcessCheck(m_strCurrentDeviceName, m_strOptions, strResponse, ref nResponseLength); // Process if (nRet == MICR_ST_OK) { m_strDocInfo = strResponse.ToString(); Output = m_strDocInfo; nRet = MTMICRGetValue(m_strDocInfo, "CommandStatus", "ReturnCode", strResponse, ref nResponseLength); strTmp = strResponse.ToString(); #region Front Image int nReti; StringBuilder strResponsei = new StringBuilder(); strResponsei.Capacity = 4096; int nResponseLengthi = 4096; int nImageSize; string strTmpi; string strImageID; nReti = MTMICRGetIndexValue(m_strDocInfo, "ImageInfo", "ImageSize", 1, strResponsei, ref nResponseLengthi); strTmpi = strResponsei.ToString(); nImageSize = Convert.ToInt32(strTmpi); if (nImageSize > 0) { nReti = MTMICRGetIndexValue(m_strDocInfo, "ImageInfo", "ImageURL", 1, strResponsei, ref nResponseLengthi); strImageID = strResponsei.ToString(); strLog = "Image size =" + nImageSize + "ImageID = " + strImageID; //MessageBox.Show(strLog); byte[] imageBuf = new byte[nImageSize]; nRet = MTMICRGetImage(m_strCurrentDeviceName, strImageID, imageBuf, ref nImageSize); if (nRet == MICR_ST_OK) { System.IO.FileStream fileWriter = new System.IO.FileStream(@"c:\test.jpg", System.IO.FileMode.Create); fileWriter.Write(imageBuf, 0, imageBuf.Length); image_Buf = imageBuf; fileWriter.Close(); int nActualSize = nImageSize; string strImageFile = g_strAppPath + "\\docimage" + ++nTotalDocProcessed + ".jpg"; int hFile = -1; hFile = CreateFile(strImageFile, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (hFile > 0) { strLog = "NumOfBytes to write =" + nActualSize; //MessageBox.Show(strLog); IntPtr pOverlapped = IntPtr.Zero; bool bRet = WriteFile(hFile, imageBuf, nImageSize, ref nActualSize, pOverlapped); } } } #endregion #region Back Image int nRetb; StringBuilder strResponseb = new StringBuilder(); strResponseb.Capacity = 4096; int nResponseLengthb = 4096; int nImageSizeb; string strTmpb; string strImageIDb; nRetb = MTMICRGetIndexValue(m_strDocInfo, "ImageInfo", "ImageSize", 2, strResponseb, ref nResponseLengthb); strTmpb = strResponseb.ToString(); nImageSizeb = Convert.ToInt32(strTmpb); if (nImageSizeb > 0) { nRetb = MTMICRGetIndexValue(m_strDocInfo, "ImageInfo", "ImageURL", 2, strResponseb, ref nResponseLengthb); strImageIDb = strResponseb.ToString(); strLog = "B Image size =" + nImageSizeb + "B ImageID = " + strImageIDb; // MessageBox.Show(strLog); byte[] imageBuf = new byte[nImageSizeb]; nRet = MTMICRGetImage(m_strCurrentDeviceName, strImageIDb, imageBuf, ref nImageSizeb); if (nRet == MICR_ST_OK) { System.IO.FileStream fileWriter = new System.IO.FileStream(@"c:\test_b.jpg", System.IO.FileMode.Create); fileWriter.Write(imageBuf, 0, imageBuf.Length); image_Buf_B = imageBuf; fileWriter.Close(); int nActualSize = nImageSizeb; string strImageFile = g_strAppPath + "\\docimage" + ++nTotalDocProcessed + ".jpg"; int hFile = -1; hFile = CreateFile(strImageFile, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (hFile > 0) { strLog = "B NumOfBytes to write =" + nActualSize; // MessageBox.Show(strLog); IntPtr pOverlapped = IntPtr.Zero; bool bRet = WriteFile(hFile, imageBuf, nImageSizeb, ref nActualSize, pOverlapped); } } } #endregion } else { strLog = "MTMICRProcessCheck return code " + Convert.ToString(nRet); MessageBox.Show(strLog); //PrintStatus(strLog); } } } catch (Exception ex) { MessageBox.Show(ex.Message + " Line Number " + ex.StackTrace); } finally { if (m_bDeviceOpened) CloseCurrentDevice(); } return Output; }
解決策 2
ProcessInit(); の定義方法を教えてください。 および SetupOptions(); 手順
[ad_2]
コメント