首页 > 代码库 > 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;