首页 > 代码库 > delphi 多线程
delphi 多线程
CoInitialize(nil); //调用COM,需要初始化
HThread: THandle;ID: DWord;HThread:= CreateThread(nil, 0, @start, nil, 0, ID);ResumeThread(HThread_1); //返回值为1,继续线程SuspendThread(HThread_1); //挂起线程
//写入INI配置,决定是否暂停线程
while True do begin cap:= IniFile.ReadString(‘UI‘,‘Button10.Caption‘,‘‘); if cap = ‘暂停(F2)‘ then begin repeat i:= ResumeThread(HThread_1); i1:= ResumeThread(HThread_2); until ((i <= 1) and (i1 <= 1)); IniFile.WriteString(‘UI‘,‘Button10.Caption‘,‘‘); end else if cap = ‘继续(F2)‘ then begin SuspendThread(HThread_1); SuspendThread(HThread_2); IniFile.WriteString(‘UI‘,‘Button10.Caption‘,‘‘); end; Delay(500); end;
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。