Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Assigning Static Button IDs
#2
Control id can be changed

Macro
Code:
Copy      Help
SetWindowLong hwnd GWL_ID newId

but the program will not know about it and possibly will stop working.

--------

Maybe you can instead use match index.
Macro
Code:
Copy      Help
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
Code:
Copy      Help
;/
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 1

Function FindTaggedControl
Code:
Copy      Help
;/
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+


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)