Then maybe this will help you understand how to achieve this. I have included 2 Versions of the basic Function, one requires WinAPI.au3 and the other doesn't.
How it works is very simple, it takes the ControlHandle of the last ControlID and then using _WinAPI_GetDlgCtrlID() converts this back into the ControlID. I have included an Example of how to take the basic Version and expand it. Now before people say "Well why don't you put GUICtrlSetBkColor() & GUICtrlSetData() underneath the Label," as much as this is true it's only showing how to do it simply without getting to complex.
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <WinAPI.au3> _Main() Func _Main() Local $hGUI $hGUI = GUICreate("_GetControlID() Example 1") GUISetState(@SW_SHOW) GUICtrlCreateLabel("Example Label", 10, 10, 150, 20) Sleep(2000) ; To Show The Label Before Changing. _Function(-1, "New Example Label") While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd GUIDelete($hGUI) EndFunc ;==>_Main Func _Function($iControlID = -1, $sData = "") $iControlID = _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($iControlID)) If @error Then Return SetError(1, 0, 0) EndIf Return GUICtrlSetData($iControlID, $sData) EndFunc ;==>_Function
Example 2: >>
Example 3: >>
NOTE: Of course people might know how to do this already but I haven't seen it documented before in the General & Example Sub-Forums.
Edited by guinness, 11 October 2011 - 01:00 PM.