Leaderboard
Popular Content
Showing content with the highest reputation on 10/10/2020 in all areas
-
WinHttp.au3: #include-once Global Const $HTTP_STATUS_OK = 200 Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Func HttpGet($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET", $sURL & "?" & $sData, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.Send() If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Example 1: #include "WinHttp.au3" Global $MD5 = HttpPost("http://www.afk-manager.ir/test/post.php", "password=WeWantThisAsMd5") MsgBox(64, "MD5", $MD5) Example 2: #include "WinHttp.au3" Global $sGet = HttpGet("http://www.google.com/") FileWrite("Google.txt", $sGet) Speed compare: [WinHttp.WinHttpRequest.5.1 GET] 1 = 422.961162765649 2 = 455.738280639636 3 = 441.821516504421 4 = 390.538648365335 Total = 1711.059608275041 Average = 427.7649020687603 [WinHttp.WinHttpRequest.5.1 POST] 1 = 826.436200956633 2 = 872.366642546045 3 = 871.266802895081 4 = 875.792832686324 Total = 3445.862479084083 Average = 861.4656197710208 [HTTP UDF GET] 1 = 984.282912132673 2 = 813.896511915435 3 = 781.158836566862 4 = 791.901235916364 Total = 3371.239496531334 Average = 842.8098741328335 [HTTP UDF POST] 1 = 788.734835486743 2 = 975.688234142967 3 = 785.810779035388 4 = 847.537193542955 Total = 3397.771042208053 Average = 849.4427605520133 [InetRead GET] 1 = 672.120733570292 2 = 595.221462195098 3 = 561.122261209642 4 = 738.180516302658 Total = 2566.64497327769 Average = 641.6612433194225 Tests result: Server 2003 32bit OK Server 2003 64bit Not Tested Server 2008 32bit Not Tested Server 2008 64bit OK XP 32bit OK XP 64bit Not Tested Vista 32bit Not Tested Vista 64bit Not Tested 7 32bit OK 7 64bit OK 8 32bit OK 8 64bit OK Are you interested? Check this out: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106(v=vs.85).aspx1 point
-
Looking closer, there are two kinds of functions exported by ntdll.dll: those which are documented part of the official Windows API (they use stdcall for X86) and those (used internally but undocumented) which come from the standard C libraries (they use cdecl for X86) which atoi is part of. Of course it isn't a good idea to rely on undocumented features and stuff, but it's currently unlikely that Windows libraries will completely change their design and undocumented interfaces today. That offers interesting ways to perform fast operations which are slow, painful or hard to code in pure AutoIt. Also given the good reliability of many simple C functions, it's safe to use them. For instance and as a trivial example, we now can easily display the full range of unsigned 64-bit integers, even in any radix (2 to 36) supported by the C functions. Here's a large int64 (treated as unsigned) displayed in base 13: Local $s = "" $aRes = DllCall("ntdll.dll", "str:cdecl", "_ui64toa", "int64", 0xFFF801201234567, "str", $s, "int", 13) ConsoleWrite($aRes[0] & @LF)1 point
-
PSPad4AutoIt3 (editor IDE)
Professor_Bernd reacted to argumentum for a topic
by no means. He invites every one @water. He's tagging just to call the attention of those users1 point -
PSPad4AutoIt3 (editor IDE)
argumentum reacted to Professor_Bernd for a topic
@argumentum @Bilgus Hello, how are you? Do you want to test a new PSPad4AutoIt3 version? The new version should now be independent of any SciTE installation and independent of the user's installed AutoIt version. I can provide you with a trial version that will not be officially released. It is a pure test version, which has no version number and is still incomplete in some areas, e.g. error messages, but functionally the version should be ok. I would be glad if you test it. Of course, this also applies to all other users. Anyone who is interested in testing this version is welcome to do so. Download PSPad4AutoIt3 version for tester 2020-10-10.zip1 point -
You're using the wrong calling convention in X86 (stdcall is by default, as the help file says). Use cdecl for calling such a X86 Windows standard C function unexpectedly exported by some system DLL. X64 uses another calling convention (fastcall) and in this mode, the calling convention specified in DllCall is simply ignored. This works in both X86 & X64: #include <Constants.au3> #include <Debug.au3> _DebugSetup() $aResult = DllCall("ntdll.dll", "int:cdecl", "atoi", "str", "1234") If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "DllCall failed with @error = " & @error) _DebugReportVar('$aResult' , $aResult) _DebugReportVar('$aResult[0]', $aResult[0])1 point
-
1 point
-
To draw a string with colors into a GDI screen
Musashi reacted to JockoDundee for a topic
Honestly, you seem confused. What do you mean no “normal way” of putting a colorbyte string somewhere? What’s a normal way? And while were at it, what exactly do you mean by “colorbyte string”? It’s not a term of art typically used in GDI. You don’t need to “fake the handle”, you use the handle to draw your “string”. One might also think “hey maybe I should post some code”. Oh you solved it, now? Using just dead ends? And the routine doesn’t “also handle a .BMP file”, it handles a string in BMP format, which is about as close a thing to a “colorbyte string” as you are gonna get. That’s why it was recommended in the first place. Wait, is it solved or not? Like I said, you seem confused.1 point -
ShellExecute / Acrobat Reader / Print verb / SW_HIDE
DesireDenied reacted to Nine for a topic
Additional information (after tests) : There is some memory usage increases using the first approach (one creating object at each print). That's corroborate your issue about too many opened documents after awhile. With the last approach (creating a persistant object), there is no more increase in memory usage. I would assume that this should solve your problem.1 point -
ShellExecute / Acrobat Reader / Print verb / SW_HIDE
DesireDenied reacted to Nine for a topic
Not exactly sure what seems to be the problem, but maybe using a persistent object ? #include <Constants.au3> #include <GUIConstants.au3> Global $oPDF = ObjCreate("AcroPDF.PDF.1") GUICreate("") GUICtrlCreateObj($oPDF, 0, 0) _Print_PDF() Func _Print_PDF() Local $hGUI = GUICreate("Example") Local $idPrint = GUICtrlCreateButton("&Print", 310, 370, 85, 25) GUISetState() Local $sFile While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idPrint $sFile = FileOpenDialog("Choose a PDF File", @ScriptDir, "PDF Files(*.pdf)", $FD_FILEMUSTEXIST+$FD_PATHMUSTEXIST) If Not @error Then _AcroPrint ($sFile) EndSwitch WEnd EndFunc ;==>_Print_PDF Func _AcroPrint($sFile) If Not FileExists($sFile) Then Return SetError(1) If Not IsObj($oPDF) Then Return SetError(2) ConsoleWrite($oPDF.GetVersions & @CRLF) $oPDF.src = $sFile $oPDF.PrintAll() EndFunc ;==>_AcroPrint I tested on a few files and it works for me...1 point -
1 point
-
If it is a SSL-connection, you have to add the secure-flag: #include<WinHTTP.au3> Func _POSTRequest($domain, $file, $query, $flags = 0) Local $hOpen, $hConnect, $hRequest $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6") $hConnect = _WinHttpConnect($hOpen, $domain) $hRequest = _WinHttpOpenRequest($hConnect, "POST", $file, 'HTTP/1.1', $WINHTTP_NO_REFERER, $WINHTTP_DEFAULT_ACCEPT_TYPES, $flags) _WinHttpAddRequestHeaders($hRequest, "Connection: Keep-Alive") _WinHttpSendRequest($hRequest, "Content-Type: application/x-www-form-urlencoded", $query) _WinHttpReceiveResponse($hRequest) Local $aReturn[2]= ['', ''] If _WinHttpQueryDataAvailable($hRequest) Then Do $aReturn[1] &= _WinHttpReadData($hRequest) Until 0=@extended EndIf $aReturn[0] = _WinHttpQueryHeaders($hRequest) _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Return $aReturn ; Array: [0]: headers, [1]: received data. EndFunc $aReturn = _POSTRequest("www.google.com","/accounts/ClientLogin","accountType=HOSTED_OR_GOOGLE&Email=[MAIL@ADDRESS]&Passwd=[PASSWORD]&service=mail&source=Gulp-CalGulp-1.05", $WINHTTP_FLAG_SECURE) MsgBox(0, '', $aReturn[0] ) MsgBox(0, '', $aReturn[1] )1 point