Aiakonai Posted July 16, 2008 Posted July 16, 2008 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. expandcollapse popup#include <GUIConstants.au3> ;#include "debug.au3" #include <String.au3> #Include <GuiComboBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) ;debug_show(1) Func sub_leave() Exit EndFunc GUICreate("Combo Err?" , 200 , 100 , 250 , 250) GUISetOnEvent($GUI_EVENT_CLOSE,"sub_leave") Dim $comboBoxAlpha = GUICtrlCreateCombo("", 10 , 10 , 140 , 70 ) GUICtrlSetData($comboBoxAlpha, "Alpha|Bravo|Charlie|Delta|Echo|Foxtrot") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() ;autocomplete copied and modified from the help file Func _Edit_Changed() _GUICtrlComboBox_AutoComplete($comboBoxAlpha) 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 _Edit_Changed() EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND While 1 Sleep(100) WEnd 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("hwnd",$hwnd) 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") _MemFree($struct_MemMap) If @error Then Return SetError(-1, -1, 0) EndIf EndFunc 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
GaryFrost Posted July 16, 2008 Posted July 16, 2008 requires Windows XP or higher. Will have to update the help documentation. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now