if Dayof(now) = 1 then begin find the calc.exe and return the handle, if found, then send the wm_close messaeg to itend;
var FSnapshotHandle:THandle; FProcessEntry32:TProcessEntry32; Ret : BOOL; ProcessID : integer; s:string; begin FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); FProcessEntry32.dwSize:=Sizeof(FProcessEntry32); Ret:=Process32First(FSnapshotHandle,FProcessEntry32); Memo1.clear; while Ret do begin Memo1.lines.add(FProcessEntry32.szExeFile); s:=ExtractFileName(FProcessEntry32.szExeFile); if s='calc.exe 'then begin ProcessID:=FProcessEntry32.th32ProcessID; TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,ProcessID),1); s:=''; end; Ret:=Process32Next(FSnapshotHandle,FProcessEntry32); end; end;
find the calc.exe and return the handle,
if found, then send the wm_close messaeg to itend;
FSnapshotHandle:THandle;
FProcessEntry32:TProcessEntry32;
Ret : BOOL;
ProcessID : integer;
s:string;
begin
FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);
Ret:=Process32First(FSnapshotHandle,FProcessEntry32);
Memo1.clear;
while Ret do
begin
Memo1.lines.add(FProcessEntry32.szExeFile);
s:=ExtractFileName(FProcessEntry32.szExeFile);
if s='calc.exe 'then
begin
ProcessID:=FProcessEntry32.th32ProcessID;
TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,ProcessID),1);
s:='';
end;
Ret:=Process32Next(FSnapshotHandle,FProcessEntry32);
end;
end;