Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread id
#1
If I have two windows, and use the same function to run simultaneously. I know this will have two different thread ids, and I can use the codes from QM help to Display all threads, but I don't know which one thread id is belong to which function, because they have use the same function name.

Because the function is loop, so it will run forever. If I want to use EndThread to stop one thread, and the other will run continually , how to do?

Macro Macro2
Code:
Copy      Help
;start1
int vk1=wait(0 K)
int+ w1 = GetMousePointWindow()
if (vk1 = 118)
,mac "Function"


if (vk1 = 119)
,;Display all threads
,int i n=EnumQmThreads(0 0 0 0)
,ARRAY(QMTHREAD) a.create(n)
,for i 0 EnumQmThreads(&a[0] n 0 0)
,,out _s.getmacro(a[i].qmitemid 1)
,,out a[i].threadid
,,out a[i].threadhandle
goto start1
#2
Macro Macro2188
Code:
Copy      Help
int ht1=mac("Function270" "" "thread 1" 300 100)
int ht2=mac("Function270" "" "thread 2" 500 100)
1
sel list("1[]2" "End thread")
,case 1 EndThread "" ht1
,case 2 EndThread "" ht2
Function Function270
Code:
Copy      Help
function $text x y
MES m.x=x; m.y=y
mes text "" m
#3
Thanks again.


Forum Jump:


Users browsing this thread: 1 Guest(s)