Jump to content
Sign in to follow this  

Making this code work with Latest AutoIT Version

Recommended Posts



I have been working on/off on a project for a while now so I have not been keeping up to date with every new AutoIT version. The version of Autoit I used before was

I have now updated to and have gotten my scripts compling and mostly working. I am having a problem though with a function I got from the forum about two years ago, (see bottom of this post for the function).

I don't exactly remember where I got this or who wrote it, but since I updated to, this seems to fail.

The actual compilation doesn't fail, but when I call this function, for example like this (attempting to get the source of an Internet_Explorer Server Object:

$wa = WinActivate($Win_hWnd)
$cc = ControlClick ($Win_hWnd, "", "[Class:Internet Explorer_Server]")
$hWnd_IEServer = ControlGetHandle($Win_hWnd,"","[Class:Internet Explorer_Server]")
If $hWnd_IEServer = "" Then;  
  _FileWriteLog($logfile, "Error getting handle to the 'Internet Explorer_Server' control" & @CRLF)
  $o_IE = _MISC_ObjGetFromHWND($hWnd_IEServer)
  If Not IsObj($o_IE) Then;; An error occurred getting the Object from the window handle
       _FileWriteLog($logfile, "Error getting the 'Internet Explorer_Server' object" & @CRLF)    ; This error message is always generated

then the error message "Error getting the 'Internet Explorer_Server' object" is always generated.

Does anybody know off hand why this doesn't work with the latest AutoIT version?

Func ObjGetFromHWND(ByRef $hWin)
    If @error Then Return SetError(@error,@extended,0)

    Local Const $WM_HTML_GETOBJECT = _MISC_RegisterWindowMessage("WM_HTML_GETOBJECT")
    If @error Then Return SetError(@error,@extended,0)
    Local Const $SMTO_ABORTIFHUNG = 0x0002
    Local $lResult, $typUUID, $aRet, $oIE

    _MISC_SendMessageTimeout($hWin, $WM_HTML_GETOBJECT, 0, 0, $SMTO_ABORTIFHUNG, 1000, $lResult)
    If @error Then Return SetError(@error,@extended,0)

    $typUUID = DLLStructCreate("int;short;short;byte[8]")

    $aRet = DllCall("oleacc.dll", "int", "ObjectFromLresult", "int", $lResult, _
            "ptr", DLLStructGetPtr($typUUID), "int", 0, "idispatch_ptr", "")
    If @error Then Return SetError(@error,@extended,0)

    If Not IsObj($aRet[4]) Then Return SetError(1,@extended,0)

    $oIE = $aRet[4].Script()
    Return $oIE

Share this post

Link to post
Share on other sites

What exactly does that do for you that _IEAttach() doesn't?

Aside from calling _MISC_ObjGetFromHWND(), but declaring _ObjGetFromHWND(), I don't see any obvious errors. But then, I have no idea what you want it to do.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.