geary 发表于 2012-6-22 00:57:50

内嵌IE如何复制验证码

本帖最后由 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

drunk 发表于 2012-6-22 01:33:55

经过测试,可以复制啊

geary 发表于 2012-6-22 12:49:48

回复 2# drunk


    纳尼??你什么系统的,win7不可以

zldfsz 发表于 2012-6-22 14:06:16

回复 3# geary
在35行后面加上sleep(100)

zldfsz 发表于 2012-6-22 15:37:56

那就再把时间延长点

wua0550 发表于 2012-6-22 17:40:20

$ss = _IEGetObjById($xxs,"vcode_img")
这句下加个延时
#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()
_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")
Sleep(1000)

$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

geary 发表于 2012-6-23 15:04:59

回复 6# wua0550


    win7加了还是无效果。

geary 发表于 2012-6-23 15:06:49

回复 5# zldfsz

加到5秒还是没成,win7的系统
页: [1]
查看完整版本: 内嵌IE如何复制验证码