验证码
Posted xupenglb
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了验证码相关的知识,希望对你有一定的参考价值。
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(‘ ‘, 256); if (GetImageFromBuffer(bs, bs.Length, result)) { vCode = result.ToString(); } else { vCode = "识别失败!"; } } return vCode; } }
以上是关于验证码的主要内容,如果未能解决你的问题,请参考以下文章
Android SMS Verification API 结果码始终为 0
爬虫遇到头疼的验证码?Python实战讲解弹窗处理和验证码识别