|
发表于 2013-1-4 00:23:36
|
显示全部楼层
本帖最后由 netegg 于 2013-1-4 00:24 编辑
[au3]Func CreateThreads()
Local $I
For $x = 0 To 59
$I = Mod($x, 10)
$tURL_COMPONENTS[$x] = DllStructCreate( _; all this is working perfectly in the DLL
"WCHAR UserAgent[1024];" & _
"WCHAR HTTPVerb[1024];" & _
"WCHAR Host[1024];" & _
"WCHAR Resource[1024];" & _
"int Port;" & _
"WCHAR Referer[1024];" & _
"WCHAR Headers[1024];" & _
"ptr ExtraData;" & _
"DWORD Length;" & _
"DWORD TotalLength;" & _
"WCHAR Proxy[1024];" & _
"DWORD ProxyFlags;" & _
"DWORD SendFlags;" & _
"HWND ListView;" & _; unused in the DLL
"ptr CallBack;" _
)
$sOptional = ''
$iOptionalLength = BinaryLen($sOptional) + 5
$tOptional[$x] = DllStructCreate("byte[" & $iOptionalLength & "]")
If $iOptionalLength Then $pOptional[$x] = DllStructGetPtr($tOptional[$x])
DllStructSetData($tOptional[$x], 1, $sOptional)
DllStructSetData($tURL_COMPONENTS[$x], 1, "(Compatable; AutoIt/v3 WinHTTP Test Script)")
DllStructSetData($tURL_COMPONENTS[$x], 2, "GET")
DllStructSetData($tURL_COMPONENTS[$x], 3, "unrealx.lt")
DllStructSetData($tURL_COMPONENTS[$x], 4, "showip.php")
DllStructSetData($tURL_COMPONENTS[$x], 5, $INTERNET_DEFAULT_HTTP_PORT)
DllStructSetData($tURL_COMPONENTS[$x], 6, '')
DllStructSetData($tURL_COMPONENTS[$x], 7, $ContentType)
DllStructSetData($tURL_COMPONENTS[$x], 8, $pOptional[$x])
DllStructSetData($tURL_COMPONENTS[$x], 9, $iOptionalLength)
DllStructSetData($tURL_COMPONENTS[$x], 10, $iOptionalLength)
DllStructSetData($tURL_COMPONENTS[$x], 11, $Proxies[$i]); Cycle through proxies for this test
DllStructSetData($tURL_COMPONENTS[$x], 12, $WINHTTP_ACCESS_TYPE_NAMED_PROXY)
DllStructSetData($tURL_COMPONENTS[$x], 13, $WINHTTP_FLAG_ESCAPE_DISABLE);WINHTTP_FLAG_SECURE
DllStructSetData($tURL_COMPONENTS[$x], 14, GUICtrlGetHandle($hListView))
DllStructSetData($tURL_COMPONENTS[$x], 15, $pCallback); set a pointer to the CallBack function
$aThread[$x] = _AutoItThreadCreate(DllStructGetPtr($tURL_COMPONENTS[$x])); Create the thread!
;$tURL_COMPONENTS = 0
Next
EndFunc ;==>CreateThreads
Func _AutoItCallBack($test, $data)
Local $Ubound = UBound($ResultsArray); get array size
ReDim $ResultsArray[$Ubound + 1][2]; redim it
$ResultsArray[$Ubound - 1][0] = $test; add data returned from thread
$ResultsArray[$Ubound - 1][1] = $data
AdlibRegister("_AddListViewItem", 5000); this will add the resulting array to the list view after no activity for 5 seconds
Return
EndFunc ;==>_AutoItCallBack[/au3]
另外,lz如果觉得刚才的回答有些憋屈,给段代码过过目,觉得过瘾否? |
|