; 以自身脚本进程为例 OwnPID := DllCall("GetCurrentProcessId") for k, v in GetProcessThreads(OwnPID) MsgBox % "ThreadID:`t`t" v GetProcessThreads(ProcessID) { if !(hSnapshot := DllCall("CreateToolhelp32Snapshot", "uint", 0x4, "uint", ProcessID)) throw Exception("CreateToolhelp32Snapshot", -1) NumPut(VarSetCapacity(THREADENTRY32, 28, 0), THREADENTRY32, "uint") if !(DllCall("Thread32First", "ptr", hSnapshot, "ptr", &THREADENTRY32)) throw Exception("Thread32First", -1), DllCall("CloseHandle", "ptr", hSnapshot) Threads := [] while (DllCall("Thread32Next", "ptr", hSnapshot, "ptr", &THREADENTRY32)) if (NumGet(THREADENTRY32, 12, "uint") = ProcessID) Threads.Push(NumGet(THREADENTRY32, 8, "uint")) return Threads, DllCall("CloseHandle", "ptr", hSnapshot) }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)