Sign in to follow this  
Followers 0

autoit version incompatability?

2 posts in this topic

Has autoit switched to the windows xp api?

I've almost come to a deadend while trying to find out why the code below does not work on windows 2k

It is straight from the helpfile with the unecessary parts cut out.

#include <GUIConstants.au3>
;#include "debug.au3"
#include <String.au3>
#Include <GuiComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)

Func sub_leave()

GUICreate("Combo Err?" , 200 , 100 , 250 , 250)
Dim $comboBoxAlpha = GUICtrlCreateCombo("", 10 , 10 , 140 , 70 )
GUICtrlSetData($comboBoxAlpha, "Alpha|Bravo|Charlie|Delta|Echo|Foxtrot")

;autocomplete copied and modified from the help file
Func _Edit_Changed()
EndFunc  ;==>_Edit_Changed

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    If Not IsHWnd($comboBoxAlpha) Then $hWndCombo = GUICtrlGetHandle($comboBoxAlpha)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF); Low Word
    $iCode = BitShift($iwParam, 16); Hi Word
    Switch $hWndFrom
        Case $comboBoxAlpha, $hWndCombo
            Switch $iCode
                Case $CBN_EDITCHANGE
EndFunc  ;==>WM_COMMAND

While 1

When I run this code on Windows XP I get no problems and it works.

When I run it on Windows 2000 it gives me an error that says

"_MemInit: Invalid window handle [0x00000000]"

So I did some debugging and found out that in the UDF

Func _GUICtrlComboBox_ReplaceEditSel($hWnd, $sText)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $struct_MemMap, $struct_String, $sBuffer_pointer
    Local $tInfo, $hEdit
    $struct_String = DllStructCreate("char Text[" & StringLen($sText) + 1 & "]")
    $sBuffer_pointer = DllStructGetPtr($struct_String)
    DllStructSetData($struct_String, "Text", $sText)

    debug("combo box info", _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo))    
    debug("tinfo" ,"*"&$tInfo&"*")
    If _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo) Then     
        $hEdit = DllStructGetData($tInfo, "hEdit")      
        debug("$hedit contains ", $hedit); this is the problem 
        _MemInit($hEdit, StringLen($sText) + 1, $struct_MemMap)     
        _MemWrite($struct_MemMap, $sBuffer_pointer)     
        _SendMessage($hEdit, $__COMBOBOXCONSTANT_EM_REPLACESEL, True, $sBuffer_pointer, 0, "wparam", "ptr")     
        If @error Then Return SetError(-1, -1, 0)

right before the _MemInit, the variable $hEdit is set using DLLStructGetData

on windows XP this returns a valid window handle

on windows 2000 this returns nothing whatsoever.

Is that because windows 2000 will no longer be supported by autoit?

If so where can I find a place to download an older version of autoit.

hmm... I wonder which key is the any key :O

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  
Followers 0