所有的吗?还是自己的?
自己的用ExtractFilePath()/ExtractFileDir()都行!
自己的用ExtractFilePath()/ExtractFileDir()都行!
解决方案 »
- delphi7 SqlServer 连接失败
- 插入数据时候,怎么样判断数据表中已经有该纪录?
- wise 9.02打包,怎检查WIN系统是否安装wps,如果没装,则运行wps的安装文件?
- 将一个磁盘映像文件虚拟成一个磁盘要怎么做???
- 谁有好的图标,做程序放在按钮上的,要大点的,32*32的就可以,给我点(在线)
- 请教:把TidUDPserver 放在TDataModule 然后封装在DLL 中, 怎么无法接受?
- 高分求救
- 过年好呀,来分了,没有什么好表示的就只好给分当压岁钱了!
- 怎样禁止某个程序运行?
- 谁有delphi的serversocket和clientsocketde多线程的原码
- @@@@@@@@@@各位帮忙,我把SQLSERVER7。0中的数据删除了,请问如何从它的log 文件进行恢复
- 写delphi程序的流程是什么?
var
Process:^TProcessinfo;
NotProcessEnd:boolean;
ProcessListHandle:THandle;
ProcessStructure:TProcessEntry32;
FP:pointer;
Pi:integer;
TmpExeFile:string;
TmpID:DWORD;
TmpProcess:^TProcessinfo;
ProcessFound:boolean;
ProcessHandle:THandle;
FCreateTime:FILETIME;
SCreateTime:SYSTEMTIME;
FExitTime:FILETIME;
// SExitTime:SYSTEMTIME;
KernelTime:FILETIME;
UserTime:FILETIME;
// KTime:integer;
// UTime:integer;
// ExitCode:DWORD;
begin
//清除CurrentList
CurrentList.Clear;
//清除NewList
NewList.Clear;
//创建Snapshot,为下一步的进程搜索作准备
ProcessListHandle:=Createtoolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
//初始化Snapshot Handle
ProcessStructure.dwSize:=sizeof(ProcessStructure);
//取第一个进程信息
NotProcessEnd:=process32First(ProcessListHandle,ProcessStructure);
//循环取下一个进程
while NotProcessEnd do
begin
TmpExeFile:=ProcessStructure.szExeFile;
TmpID:=ProcessStructure.th32ProcessID;
//初始化进程搜索标志
ProcessFound:=false;
//在已存在的进程列表中搜索进程
for Pi:=0 to ProcessList.Count-1 do
begin
TmpProcess:=ProcessList.Items[Pi];
if (TmpExeFile=TmpProcess.ExeFile)and(TmpID=TmpProcess.ProcessID) then
begin//进程已存在
//修改进程检测时间
TmpProcess.EndTime:=Time;
//添加到当前进程列表中
CurrentList.Add(TmpProcess);
//更改进程搜索标志
ProcessFound:=true;
//退出已知进程搜索循环
break;
end;
end;
//如果进程已存在,则跳过新建节点代码
if ProcessFound then
begin
//得到下一个进程
NotProcessEnd:=Process32Next(ProcessListHandle,ProcessStructure);
continue;
end;
//创建新进程接点
New(Process);
//取进程相关信息
Process.ExeFile:=ProcessStructure.szExeFile;
Process.ProcessID:=ProcessStructure.th32ProcessID;
Process.BasePrior:=ProcessStructure.pcPriClassBase;
Process.ParentID:=ProcessStructure.th32ParentProcessID;
Process.ThreadNum:=ProcessStructure.cntThreads;
Process.FirstWindows:=0;
//Process.BeginTime:=Time;
//Process.EndTime:=Time;
//通过进程ID得到进程句柄
ProcessHandle:=OpenProcess(PROCESS_QUERY_INFORMATION,true,Process.ProcessID); //取进程相关时间
GetProcessTimes(ProcessHandle,FCreateTime,FExitTime,KernelTime,UserTime);
{if GetExitCodeProcess(ProcessHandle,ExitCode) then
Process.ParentID:=ExitCode
else Process.ParentID:=0;}
closeHandle(ProcessHandle);
//转换进程创建时间
FileTimeToLocalFileTime(FCreateTime,FCreateTIme);
FileTimeToSystemTime(FCreateTime,SCreateTime);
//FileTimetoSystemTime(FExitTime,SExitTIme);
//FileTimeToSystemTime(KernelTime,SKTime);
//FileTimetoSystemTime(UserTime,SUTime);
GetProcessBase(Process^,KernelTime, UserTime);
{
try
if (SystemTimeToDateTime(SKTime)>SystemTimeToDateTime(SUTime)) then
Process.ProcessBase:='系统进程';
except
Process.ProcessBase:='系统进程';
end;}
// showmessage(Process.ExeFile);
// Process.ProcessBase:='系统进程';
try
Process.BeginTime:=SystemTimeToDateTime(SCreateTime);
except
Process.BeginTime:=Date;
end;
Process.EndTime:=Date+Time;
{
//转换当前时区
//SystemTimeToTzSpecificLocalTime(@TimeZone,Process.createTime,SCreateTime);
//得到时间字符串
//GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT,@SCreateTime,CTimeStr,'HH'':''mm'':''ss',11);
//转换进程撤消时间
//FileTimetoSystemTime(ExitTime,process.TerminateTime);
}
//添加新进程
ProcessList.Add(Process);
//添加到新进程列表
NewList.Add(Process);
//添加到当前进程列表
CurrentList.Add(Process);
//得到下一个进程
NotProcessEnd:=Process32Next(ProcessListHandle,ProcessStructure);
end;
ClearWindowText;
CallbackFunction(FP):=EnumWindowsProc;
//初始化回调函数
ThreadListNum:=0;
{//检索窗口
EnumWindows(FP,0);
CloseHandle(ProcessListHandle);//别忘了释放Snapshot Handle
end;