#AutoIt3Wrapper_UseX64 = n
#include <GDIPlus.au3>
$bjiniwj = 'D:\sz.ini'
;$hGUI = GUICreate("DDDDocr", 900, 380)
GUISetState()
_GDIPlus_Startup()
InitModel()
;For $i = 0 To 29
; Local $x = 180 * Mod($i, 5) + 5, $y = 60 * Floor($i / 5) + 10
$dImage = InetRead ("http://127.0.0.1/yzm/xz.jpg" ) ;& $i, 1
$hImage = _GDIPlus_BitmapCreateFromMemory($dImage)
;$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
;_GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, $x, $y, 170, 40)
Local $img = DllStructCreate('byte[' & BinaryLen($dImage) + 1 & ']')
DllStructSetData($img, 1, $dImage)
; GUICtrlCreateLabel('Online:' & _Httpdddd($dImage) & ' Offline:' & Identify($img, $dImage), $x + 5, $y + 45)
If IniWrite($bjiniwj, 'yzm', 'yzm', Identify($img, $dImage)) Then
exit
endif
_GDIPlus_ImageDispose($hImage)
; _WinAPI_DeleteObject($hGraphics)
;Next
_GDIPlus_Shutdown()
FreeModel()
While True
Switch GUIGetMsg()
Case - 3
ExitLoop
EndSwitch
WEnd
Func InitModel()
Local $Result = DllCall(@ScriptDir & '\ddocr_qs.dll', 'bool', 'InitModel', 'int', 6, 'bool', True)
Return $Result[0]
EndFunc
Func Identify($img, $imlen)
Local $Result = DllCall(@ScriptDir & '\ddocr_qs.dll', 'str', 'Identify', 'ptr', DllStructGetPtr($img), 'int', BinaryLen($imlen))
Return $Result[0]
EndFunc
Func FreeModel()
Local $Result = DllCall(@ScriptDir & '\ddocr_qs.dll', 'bool', 'FreeModel')
Return $Result[0]
EndFunc
Func _Httpdddd($img)
Local $bData = Binary('---' & @CRLF & _
'Content-Disposition: form-data; name="image"; filename="image"' & @CRLF & @CRLF) & _
StringTrimLeft($img, 2) & StringTrimLeft(Binary(@CRLF & '-----'), 2)
Local $oHttp = ObjCreate('WinHttp.WinHttpRequest.5.1')
$oHttp.Open('POST', 'http://42.192.1.233:9898/ocr/file/text', True)
$oHttp.SetRequestHeader('Content-Type', 'multipart/form-data;boundary=-')
$oHttp.Send(Binary($bData))
$oHttp.WaitForResponse()
Return BinaryToString($oHttp.ResponseBody())
EndFunc |