需要安装的软件
  1、安装ImageMagick安装完成后,将其安装路径添加到环境变量path中
  2、安装Tesseract-OCR
#define MAX_NAME_LEN 4 //定义验证码字符串的长度,这里是4位
int flen;        //定义一个整型变量保存获得文件的大小
long filedes;
long filedess;    //保存文件句柄
char file[256]="c:\test1.jpg";  //保存文件路径及文件名
char result[4];//定义用于从文件中读取验证码的数组
web_set_max_html_param_len("2000000");
//设置页面接收大的字节数,该设置应大于下载文件的大小
//下载含有验证码的网页元素,并将其保存到参数中
web_reg_save_param_ex(
"ParamName=pic",
"LB=",
"RB=",
SEARCH_FILTERS,
"Scope=Body",
"RequestUrl=*/action/ValidateCodeServlet*",
LAST);
//关联登录时与服务器产生的会话ID
web_reg_save_param_ex(
"ParamName=CorrelationParameter_1",
"LB=Set-Cookie: JSESSIONID=",
"RB=; Path",
SEARCH_FILTERS,
"Scope=All",
"RequestUrl=*/192.168.12.1:8080/*",
LAST);
//访问测试网站
web_url("192.168.12.1:8080",
"URL=http://192.168.12.1:8080/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/images/login_screenbg.jpg", ENDITEM,
"Url=/images/login_midbg.jpg",ENDITEM,
"Url=/images/login_contentbg.jpg", ENDITEM,
"Url=/images/login_btn.png", ENDITEM,
"Url=/images/login_input1.png",ENDITEM,
"Url=/images/login_input2.png",ENDITEM,
"Url=/images/reset_btn.png",ENDITEM,
LAST);
flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);