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;
时间: 2024-08-26 10:53:40