03-07-2009, 10:29 AM
Control id can be changed
Macro
but the program will not know about it and possibly will stop working.
--------
Maybe you can instead use match index.
Macro
---------
Or set a property and then find control that has the property.
Function TagControl
Function FindTaggedControl
Macro
but the program will not know about it and possibly will stop working.
--------
Maybe you can instead use match index.
Macro
int w1=child("text" "class" hwnd 0 0 0 1)
int w2=child("text" "class" hwnd 0 0 0 2)
;...---------
Or set a property and then find control that has the property.
Function TagControl
;/
function hwndControl $tag
;Assigns a string (tag) to the control. The control then can be found by FindTaggedControl.
;hwndControl - control handle.
;tag - some unique string. Use the same string with FindTaggedControl.
SetProp hwndControl tag 1Function FindTaggedControl
;/
function# hwndParent $tag [$text] [$classname] [flags] [ctrlId]
;Finds control previously tagged by TagControl. Returns its handle. If does not find, returns 0.
;tag - the same string that used with TagControl.
;other arguments - the same as with function child.
;See also: <TagControl>
;EXAMPLE
;int hwndParent=win("Calculator")
;int w1=id(126 hwndParent) ;;button "2"
;TagWindow w1 "b2"
;int w2=FindTaggedControl(hwndParent "b2")
ARRAY(int) a; int i h
if(ctrlId) h=child(ctrlId text classname hwndParent flags 0 0 a)
else h=child(text classname hwndParent flags 0 0 a)
for(i 0 a.len) if(GetProp(a[i] tag)) ret a[i]
err+