Swimming_Bird Posted July 6, 2005 Share Posted July 6, 2005 Bottom line is i need to get that combo box to read a variable i have in the script and i'm only getting 0 when using GUICtrlRead ( 4480 ) Link to comment Share on other sites More sharing options...
FuryCell Posted July 6, 2005 Share Posted July 6, 2005 I think GUICtrlRead() only works with GUI created by AutoIt.Bottom line is i need to get that combo box to read a variable i have in the script and i'm only getting 0 when using GUICtrlRead ( 4480 )<{POST_SNAPBACK}>Try this UDF:;=============================================================================== ; ; Description: _GUICtrlComboGetCurSel ; Parameter(s): $h_combobox - controlID ; Requirement: None ; Return Value(s): The return value is the zero-based index of the currently selected item. ; If no item is selected, it is $CB_ERR ; User CallTip: _GUICtrlComboGetCurSel($h_combobox) Retrieve the index of the currently selected item, if any, in the list box of a combo box (required: <GuiCombo.au3>) ; Author(s): Gary Frost (custompcs@charter.net) ; Note(s): : ; ;===============================================================================You need to get the udf update here and do #Include <GUICombo.au3> to use it. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
GaryFrost Posted July 6, 2005 Share Posted July 6, 2005 That won't work either, they were built for the AutoIt Gui. Will need to do a dllcall. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Swimming_Bird Posted July 6, 2005 Author Share Posted July 6, 2005 doesnt seem like its worth it. i'll try to figure out another way. thx Link to comment Share on other sites More sharing options...
GaryFrost Posted July 6, 2005 Share Posted July 6, 2005 (edited) Here ya go. You'll still need beta if you want the text from the selected item. Global Const $CB_ERR = -1 Global Const $CB_GETCURSEL = 0x147 Global Const $CB_GETLBTEXT = 0x148 Global Const $CB_GETLBTEXTLEN = 0x149 WinActivate("Options") $hcombobox = ControlGetHandle("Options","","ComboBox4") $ret = DllCall("user32.dll","int","SendMessage","hwnd",$hcombobox, "int", $CB_GETCURSEL, "int", 0, "int", 0) MsgBox(0,"test",$ret[0]) $s_text = "" _ComboGetLBText($hcombobox, $ret[0], $s_text) MsgBox(0,"text",$s_text) Func _ComboGetLBText($hcombobox, $i_index, ByRef $s_text) Local $ret = DllCall("user32.dll","int","SendMessage","hwnd",$hcombobox, "int", $CB_GETLBTEXTLEN, "int", $i_index, "int", 0) Local $i, $len $len = $ret[0] $s_text = "" Local $p $p = DllStructCreate ("char[" & $len + 1 & "]") $ret = DllCall("user32.dll","int","SendMessage","hwnd", $hcombobox, "int", $CB_GETLBTEXT, "int", $i_index, "ptr", DllStructGetPtr ($p)) If ($ret[0] == $CB_ERR) Then DllStructDelete ($p) Return $CB_ERR EndIf $s_text = DllStructGetData ($p, 1) DllStructDelete ($p) Return $ret[0] EndFunc ;==>_ComboGetLBText Edited July 6, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
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