Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

Have anyone worked in implementation of Magtek Excella device dll in Windows application ?

I am trying to Process n number of cheques at a time using MTMICRProcessCheck() Method.

In my Setup options i have kept DocFeed as AUTOFEED still it takes two cheques for processing and not n number of cheques.
As my result i get a XML string having info for 1st scanned cheque only.

If someone has implemented the same,kindly help !
Posted
Updated 5-Apr-23 20:43pm
Comments
super 18-Mar-15 5:14am    
I am not sure how to help without any look at your code. But to my understanding MTMICRProcessCheck() is a API function which process only one document at the time. So you need to verify the calling function to see if MTMICRProcessCheck is called "n" number of times? Try to put n =2 and see if this function is called MTMICRProcessCheck() two times.

1 solution

Here is my code,For reference

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;
        }
 
Share this answer
 
v2
Comments
Samba Vemula 6-Apr-23 4:23am    
Can you please show us how you define ProcessInit(); and SetupOptions(); procedures

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900