I slightly modified:
Code: Select all
exethread(s:="",p:=""){
return lib:=GetModuleHandle(),{(""):ThreadID:=NewThread(s,p)
,_ahkFunction:DynaCall(GetProcAddress(lib,"ahkFunction"),"s==sttttttttttui","",0,0,0,0,0,0,0,0,0,0,ThreadID)
,_ahkPostFunction:DynaCall(GetProcAddress(lib,"ahkPostFunction"),"i==sttttttttttui","",0,0,0,0,0,0,0,0,0,0,ThreadID)
,ahkFunction:DynaCall(GetProcAddress(lib,"ahkFunction"),"s==sssssssssssui","",0,0,0,0,0,0,0,0,0,0,ThreadID)
,ahkPostFunction:DynaCall(GetProcAddress(lib,"ahkPostFunction"),"i==sssssssssssui","",0,0,0,0,0,0,0,0,0,0,ThreadID)
,addFile:DynaCall(GetProcAddress(lib,"addFile"),"ut==siui","",0,ThreadID)
,addScript:DynaCall(GetProcAddress(lib,"addScript"),"ut==siui","",0,ThreadID)
,ahkExec:DynaCall(GetProcAddress(lib,"ahkExec"),"ut==sui","",ThreadID)
,ahkExecuteLine:DynaCall(GetProcAddress(lib,"ahkExecuteLine"),"ut==utuiuiui",0,0,0,ThreadID)
,ahkFindFunc:DynaCall(GetProcAddress(lib,"ahkFindFunc"),"ut==sui","",ThreadID)
,ahkFindLabel:DynaCall(GetProcAddress(lib,"ahkFindLabel"),"ut==sui","",ThreadID)
,ahkgetvar:DynaCall(GetProcAddress(lib,"ahkgetvar"),"s==suiui","",0,ThreadID)
,ahkassign:DynaCall(GetProcAddress(lib,"ahkassign"),"s==ssui","","",ThreadID)
,ahkLabel:DynaCall(GetProcAddress(lib,"ahkLabel"),"ui==suiui","",0,ThreadID)
,ahkPause:DynaCall(GetProcAddress(lib,"ahkPause"),"ui==sui","",ThreadID)
,ahkIsUnicode:DynaCall(GetProcAddress(lib,"ahkIsUnicode"),"ui==")}
}
Code: Select all
this.hThreadID:=NewThread("global A_ParentThread`nA_ParentThread(){`nstatic _:=A_ParentThread()`nA_ParentThread:=ObjShare(" ObjShare(new _ThreadClass) ")`nObjShare(" ObjShare(this) ").RegisterThread(ObjShare(ThreadObj_Class()))`n}`n" script,cmdLine)
-------------
Also, I have an idea I have said to you: to increase the definition of the title.
I found that for multi-threaded, it has a huge role.
It allows us to easily identify the thread.
For example, it is clear to know which thread pops up "MsgBox"
Code: Select all
NewThread(Script, cmdLine:="", title:="")
a_ahktitle
But it uses too much time.
-------------
Also, About thread parameters
In my experience, many threads need to pass parameters. Otherwise, it takes more time to take the initiative to get the data.
We can support it?
Its difficulty is to pass object parameters
Code: Select all
NewThread(Script, cmdLine:="", title:="", param:="")
a_ahkparam