你是没有gdiplusex.au3文件,用下面代码吧
#include <INet.au3>
#include <winapiex.au3>
#include <GDIPlus.au3>
#include <Memory.au3>
Opt("GUICloseOnESC", 0)
$yzm = "http://218.87.6.198/portal/bmp2.jsp"
$hGui = GUICreate("验证码", 300, 200)
$Label3 = GUICtrlCreateLabel("验证码:", 14, 90, 50, 17)
$Input3 = GUICtrlCreateInput("", 70, 86, 50, 21)
$Pic1 = GUICtrlCreatePic("", 130, 90, 50, 20)
Global $hPic = GUICtrlGetHandle(-1)
GUISetState(@SW_SHOW)
xsyzm()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Pic1
xsyzm()
EndSwitch
WEnd
Func xsyzm()
$bImage = _INetGetSource($yzm, False)
$bData = Binary($bImage)
$Lenght = BinaryLen($bData)
$hData = _MemGlobalAlloc($Lenght, 0x0002)
$pData = _MemGlobalLock($hData)
$tData = DllStructCreate('byte[' & $Lenght & ']', $pData)
DllStructSetData($tData, 1, $bData)
_MemGlobalUnlock($hData)
$pStream = _WinAPI_CreateStreamOnHGlobal($hData)
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromStream($pStream)
$hBitMap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$Width = _GDIPlus_ImageGetWidth($hImage)
$Height = _GDIPlus_ImageGetHeight($hImage)
_GDIPlus_ImageDispose($hImage)
_MemGlobalFree($hData)
_GDIPlus_Shutdown()
$oldObj = _SendMessage($hPic, 0x0172, 0, $hBitMap)
_WinAPI_DeleteObject($oldObj)
Local $hObj = _SendMessage($hPic, 0x0173)
If $hObj <> $hBitMap Then
_WinAPI_DeleteObject($hBitMap)
EndIf
DllCall('psapi.dll', 'int', 'EmptyWorkingSet', 'hWnd', -1)
EndFunc ;==>xsyzm
Func _GDIPlus_BitmapCreateFromStream($pStream)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $pStream, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
$GDIP_STATUS = $aResult[0]
Return $aResult[2]
EndFunc ;==>_GDIPlus_BitmapCreateFromStream
|