本帖最后由 geary 于 2012-6-22 13:05 编辑
原本没用内嵌IE可以把验证码保存到本地,但在复制图片时会弹出对话框,听别人说内嵌IE就不会弹出对话框,所以用了内嵌IE,但却无法复制验证码保存到本地,求帮助。刚才又测试了下,xp成功过一次,之后就没成功过,win7的话一直没成功。。#include <IE.au3>
#include <Clipboard.au3>
#Include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("Button1", 248, 384, 75, 25)
GUICtrlSetOnEvent(-1, "pp1")
$xxs =_IECreateEmbedded ()
GUICtrlCreateObj($xxs, 24, 8, 561, 369)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc
Func pp1()
$oIE = _IENavigate($xxs,"http://reg.email.163.com/mailregAll/reg0.jsp?from=163mail_right")
$ss = _IEGetObjById($xxs ,"unameInp")
_IEFormElementSetValue ($ss, "asdas")
$ss = _IEGetObjById($xxs,"passwInp")
_IEFormElementSetValue ($ss, "1234512345")
$ss = _IEGetObjById($xxs,"passConfim")
_IEFormElementSetValue ($ss, "1234512345")
$ss = _IEGetObjById($xxs,"vcode_img")
$oPic = $xxs.Document.body.createControlRange()
$oPic.Add($ss)
$oPic.execCommand("copy")
$bmp = ClipGet()
_GDIPlus_Startup()
_ClipBoard_Open(0)
$iVerifyPics = _ClipBoard_GetDataEx($CF_BITMAP)
$iVerifyPics = _GDIPlus_BitmapCreateFromHBITMAP($iVerifyPics)
_ClipBoard_Close()
FileDelete(@ScriptDir & "\123.bmp")
_GDIPlus_ImageSaveToFile($iVerifyPics, @ScriptDir & "\123.bmp")
EndFunc
|