Jump to content

Recommended Posts

Posted (edited)

Hi all guys,

In my code sometimes I get this error on my compiled Crypto analyzer

There are 2 objects that can lead to this:

1) Telegram

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 ;==> __HttpGet

 

2) API integration with Crpyto Exchanges

Local $oHTTP = ObjCreate($oObject)
$sURL = $g_sCrypto_URL & $sURL
$oHTTP.Open($oMode, $sURL, False)
$oHTTP.Send()
Local $sReceived = $oHTTP.ResponseText
ConsoleWrite($sReceived)

These errors are not critical but annoying because they open Pop-Up and if I'm not in front of the screen program freezes (API calls are called by multitask calls)

How can avoid to have the pop-up showing?

Surely not this:

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")    ; Initialize a COM error handler
; This is my custom defined error handler
Func MyErrFunc()
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
Endfunc

Maybe this?

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")    ; Initialize a COM error handler
; This is my custom defined error handler
Func MyErrFunc()
  msgbox(48,"Error","API communication error",5)    ; <--- should close in 5 secs
Endfunc

Could it work ?

Thanks in advance

Edited by marko001
Posted (edited)

@marko001

  • let it be in Line of Script:
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
  • Remove MsgBox From Function: 
MyErrFunc()
  • -replace it content's[MyErrFunc()] with -> Return true or empty
  • just Put ; after If @error Then MsgBox(.... if there is any... ex:
  ;If @error Then MsgBox($MB_SYSTEMMODAL, "COM Error", "@error is set to COM error number." & @CRLF & "@error = 0x" & Hex(@error)) 

 
Edited by ad777

none

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...