Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
From Window name to thread id & name
#1
Given a qm-generated window I need to get its thread-id and also its thread name. I wonder whether there exists a standardized way to do it. Therefore, I have written the following function. Any comments or advice is mostly welcome. Many thanks in advance.

Function WindowToThreadName
Code:
Copy      Help
;---> Comment 10-01-2017 22:35:46 :  It needs Dialog44 running

int w=win("Dialog Header" "#32770")
if w=0; ret
int thrd=GetWindowThreadProcessId(w 0)
out F"Thread id : {thrd}"
int i n j
n=EnumQmThreads(0 0 0 0)
ARRAY(QMTHREAD) a.create(n)
for i 0 EnumQmThreads(&a[0] n 0 0)
,j=j+1
;,out F"{i} {a[i].threadid} {a[i].qmitemid} {a[i].threadhandle}"
,if a[i].threadid=thrd
,,out F"Thread name : {_s.getmacro(a[i].qmitemid 1)}"
,,break
if i=j
,out "Thread not found"
,
#2
Only this way.
#3
Many thanks indeed !


Forum Jump:


Users browsing this thread: 1 Guest(s)