05-18-2021, 11:05 PM
Hello
I'm struggling to use the EndThread function to stop a sub-function running in a separate thread, in an .exe. It works fine in QM but once it's in .exe the thread is not found, maybe it has a different name or i'm doing it wrong ?
Here is an example :
Macro EndThreadSub
I'm struggling to use the EndThread function to stop a sub-function running in a separate thread, in an .exe. It works fine in QM but once it's in .exe the thread is not found, maybe it has a different name or i'm doing it wrong ?
Here is an example :
Macro EndThreadSub
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 132 84 "Dialog" "4"
;3 Static 0x54000000 0x0 40 10 56 12 "Text"
;4 Button 0x54032000 0x0 16 24 103 37 "Click here to stop count (works in QM but not in .exe, different thread name ?)"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C00 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,,mac "sub.counting" hDlg
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,,case 4 ;;Click here to stop count
,,,EndThread("EndThreadSub:counting")
ret 1
#sub counting
str dlg_id=_command;int hDlg=val(dlg_id)
rep
,_i+1
,_s=F"{_i}";_s.setwintext(id(3 hDlg))
,1