首页 > 其他 > 详细

验证码

时间:2018-06-29 10:37:49      阅读:159      评论:0      收藏:0      [点我收藏+]
public class VerificationCode
    {
        [DllImport("WmCode.dll")]
        public static extern bool LoadWmFromFile(string FilePath, string Password);

        [DllImport("WmCode.dll")]
        public static extern bool SetWmOption(int OptionIndex, int OptionValue);

        [DllImport("WmCode.dll")]
        public static extern bool GetImageFromBuffer(byte[] FileBuffer, int ImgBufLen, StringBuilder Vcode);

        public static string GetVerCode(byte[] bs)
        {
            string vCode = string.Empty;
            string path = AppDomain.CurrentDomain.BaseDirectory + "bin\\YongAn.dat";
            if (LoadWmFromFile(path, "123456"))
            {
                //SetWmOption(6, 90);
                StringBuilder result = new StringBuilder(‘\0‘, 256);
                if (GetImageFromBuffer(bs, bs.Length, result))
                {
                    vCode = result.ToString();
                }
                else
                {
                    vCode = "识别失败!";
                }
            }
            return vCode;
        }
    }

  

验证码

原文:https://www.cnblogs.com/XuPengLB/p/9241790.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!