验证码会过期的 ,网页操作如下,可以根据需要修改下:Func _Get_pic($oIE, $oID)
Local $Temp = @TempDir & "\VerifyPic.png"
Local $Pic = @TempDir & "\VerifyPic.jpg"
FileDelete($Temp)
FileDelete($Pic)
$oImg = _IEGetObjById($oIE, $oID);获取图片对象
$oPic = $oIE.Document.body.createControlRange()
$oPic.Add($oImg)
$oPic.Select()
$oPic.execCommand("Copy")
;$oPic = ClipGet();win7下可以获取缓存路径
_GDIPlus_Startup()
_ClipBoard_Open(0)
$oPic = _ClipBoard_GetDataEx($CF_BITMAP)
$oPic = _GDIPlus_BitmapCreateFromHBITMAP($oPic)
_ClipBoard_Close()
_GDIPlus_ImageSaveToFile($oPic, $Temp)
_GDIPlus_ImageDispose ($oPic); 清除资源
_GDIPlus_ShutDown ()
_Encoder_pic($Temp, $Pic);如果图片为png不能直接显示到gui可以使用下面的函数转换下为jpg或bmp等
GUICtrlSetImage($Pic1, $Pic)
EndFunc
Func _Encoder_pic($Temp, $Pic)
Local $GUID, $Params, $Datas
_GDIPlus_Startup()
$Image = _GDIPlus_ImageLoadFromFile($Temp)
$GUID = _GDIPlus_EncodersGetCLSID("jpg")
$Params = _GDIPlus_ParamInit (1)
$Datas = DllStructCreate("int Quality")
DllStructSetData($Datas, "Quality", 100);jpg图片质量
_GDIPlus_ParamAdd($Params, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, DllStructGetPtr($Datas))
_GDIPlus_ImageSaveToFileEx($Image, $Pic, $GUID, DllStructGetPtr($Params))
_GDIPlus_ImageDispose ($Image); 清除资源
_GDIPlus_ShutDown ()
EndFunc
|