#include <GDIPlus.au3>
#include <Memory.au3>
#include <WinAPIEx.au3>
Global Const $STM_SETIMAGE = 0x0172
Global Const $STM_GETIMAGE = 0x0173
Global $hForm, $nPic, $hPic, $hBitmap, $hObj, $hImage, $hStream, $bData, $hData, $pData, $tData, $iWidth, $iHeight, $iLenght
Global $sLinks = 'http://www.urban-rivals.com/sub/captcha/button.php'
HttpSetProxy(1)
$bData = InetRead($sLinks, 17)
If @error Then Exit 13
$iLenght = @extended
If Not $iLenght Then Exit
$hData = _MemGlobalAlloc($iLenght, 2)
$pData = _MemGlobalLock($hData)
$tData = DllStructCreate('byte[' & $iLenght & ']', $pData)
DllStructSetData($tData, 1, $bData)
_MemGlobalUnlock($hData)
$hStream = _WinAPI_CreateStreamOnHGlobal($hData)
_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromStream($hStream)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$iWidth = _GDIPlus_ImageGetWidth($hImage)
$iHeight = _GDIPlus_ImageGetHeight($hImage)
_WinAPI_ReleaseStream($hStream)
_MemGlobalFree($hData)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
$hForm = GUICreate('captcha', $iWidth * 2, $iHeight * 2)
$nPic = GUICtrlCreatePic('', $iWidth / 2, $iHeight / 2)
$hPic = GUICtrlGetHandle($nPic)
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
$hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
GUISetState()
Do
Until GUIGetMsg() = -3
;~ Func _GDIPlus_BitmapCreateFromStream($hStream) ;для 3.3.8.1
;~ Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCreateBitmapFromStream', 'ptr', $hStream, 'int*', 0)
;~ If @error Then
;~ Return SetError(@error, @extended, 0)
;~ EndIf
;~ Return $aResult[2]
;~ EndFunc ;==>_GDIPlus_BitmapCreateFromStream