你需要的是识别的,无能为力.........仍然希望对你有用#include <GUIConstantsEx.au3>
$iOptOld = Opt("GUIEventOptions", 0)
Opt("GUIEventOptions", $iOptOld)
Global $Char, $t1, $t2, $t3
Global $t5
yzm(0)
Func yzm($t0)
Local $t4
$t5 = 0
$hWnd = GUICreate("验证码例子", 175, 155, -1, -1, 0x00080000)
$cBg = GUICtrlCreateLabel("", 10, 10, 150, 50)
GUICtrlSetState($cBg, 128)
GUICtrlSetBkColor($cBg, 0x000000)
$cInput = GUICtrlCreateInput("", 10, 70, 150, 20)
$cCheck = GUICtrlCreateButton("识别", 10, 95, 70)
$cNew = GUICtrlCreateButton("刷新", 90, 95, 70)
$t4 = yzm_Create()
$cFg = GUICtrlCreateLabel("", 10, 10, 150, 50)
GUICtrlSetBkColor($cFg, -2)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $cNew
yzm_Delete()
$t4 = yzm_Create()
GUICtrlSetData($cInput, "")
Case $cCheck
If $t5 == $t0 - 1 Then
yzm_Delete()
GUIDelete($hWnd)
Return False
ExitLoop
Else
If (GUICtrlRead($cInput) == $t4) Then
yzm_Delete()
GUIDelete($hWnd)
Return True
ExitLoop
Else
$t5 += 1
MsgBox(0, "结果", $t4)
yzm_Delete()
$t4 = yzm_Create()
GUICtrlSetData($cInput, "")
EndIf
EndIf
EndSwitch
WEnd
EndFunc ;==>yzm
Func yzm_Create()
Local $sCaptcha = yzm_Generate()
Local $iX = Random(15, 25, 1)
Local $iY = Random(15, 40, 1)
$t3 = "Arial Black"
$t3 = "Comic Sans MS"
$t3 = "Impact"
$t3 = "Tahoma"
$t3 = "System"
$t3 = "Verdama"
$aSplit = StringSplit($sCaptcha, "")
For $x = 0 To 5
$Char[$x] = GUICtrlCreateLabel($aSplit[$x + 1], $iX, $iY)
$iX += 20 + Random(1, 5, 1)
$iY = Random(15, 40, 1)
GUICtrlSetBkColor($Char[$x], -2)
GUICtrlSetColor($Char[$x], Random(0x808080, 0xC0C0C0))
$iNum = Random(1, 7, 1)
Switch $iNum
Case 1
$iStyle = 2 ;2
Case 2
$iStyle = 4 ;4
Case 3
$iStyle = 8 ;8
Case 4
$iStyle = 2 + 4 ;6
Case 5
$iStyle = 4 + 8 ;12
Case 6
$iStyle = 2 + 8 ;10
Case 7
$iStyle = 2 + 4 + 8 ;16
EndSwitch
GUICtrlSetFont($Char[$x], 13, Random(350, 450, 1), $iStyle, $t3)
Sleep(10)
Next
$iX = 15 + Random(1, 10, 1)
$iY = 5 + Random(1, 10, 1)
For $z = 0 To 4
$t1[$z] = GUICtrlCreateLabel("", $iX, $iY, 1, 30)
$iX += 25 + Random(1, 10, 1)
$iY = 5 + Random(1, 30, 1)
GUICtrlSetBkColor($t1[$z], Random(0x808080, 0xC0C0C0))
Next
$iX = 5 + Random(1, 25, 1)
$iY = 20 + Random(1, 10, 1)
For $b = 0 To 1
$t2[$b] = GUICtrlCreateLabel("", $iX, $iY, 130, 1)
$iX = 5 + Random(1, 10, 1)
$iY += 10 + Random(1, 10, 1)
GUICtrlSetBkColor($t2[$b], Random(0x808080, 0xC0C0C0))
Next
Return $sCaptcha
EndFunc ;==>yzm_Create
Func yzm_Delete()
For $y = 0 To 5
GUICtrlDelete($Char[$y])
Next
For $a = 0 To 4
GUICtrlDelete($t1[$a])
Next
For $c = 0 To 1
GUICtrlDelete($t2[$c])
Next
EndFunc ;==>yzm_Delete
Func yzm_Generate()
Local $sCharacters = StringSplit("BCDFGHJKLMNPQRSTVWXYZ1234567890", "")
Local $sCode = ""
For $i = 1 To 6
$sCode &= $sCharacters, 1)]
Next
Return $sCode
EndFunc ;==>yzm_Generate
头大~~~~~``http://www.pgpop.com/image/face1.gif
http://bbs.hangzhou.com.cn/images/default/sigline.gif
怎样祛斑最有效 回复 16# arkhe
这个教学很好啊,学习的东西多 这个好像没有办法实现, 因为生成验证码的方式就是画图和随机的方式. 呵呵,支持
页:
1
[2]