如何获取正在运行的进程的启动时间
How do I get time of launch of a running process?
我正在尝试获取正在运行的进程的启动时间。是否可以在Windows中执行此操作,请如何?
您可以使用 GetProcessTimes() 函数。使用 GetCurrentProcess() 获取当前进程的句柄。
它的一个参数(lpCreationTime
)是一个指向FILETIME
结构的指针,该结构被填充到进程的创建时间。
然后,您可以使用 FileTimeToSystemTime() 将FILETIME
结构转换为具有日历日/月/年和小时/分钟/秒字段的SYSTEMTIME
结构。
HANDLE hCurrentProcess = GetCurrentProcess();
FILETIME creationTime;
FILETIME exitTime;
FILETIME kernelTime;
FILETIME userTime;
GetProcessTimes(hCurrentProcess, &creationTime,
&exitTime, &kernelTime, &userTime);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&creationTime, &systemTime);
// systemTime now holds the calendar date/time the
// current process was created
相关文章:
- 如何使用 c++ libboost 运行进程并获取其输出?
- 如何运行进程,然后在它退出时收到通知
- 在特定监视器上运行进程
- 使用Runtime.exec从Java运行进程-退出代码139
- 使用C++将CPU专用于在1个核心上运行进程
- 如何找到运行进程的物理套接字 ID/编号
- 如果从文件中读取,则无法按文件名运行进程
- 如何判断进程的用户令牌是否与运行进程的登录会话令牌相同?
- 在 C 语言的后台运行进程
- 在C++中获取带有 Windows 7 API 的运行进程
- r语言 - 如何直接在数据库服务器上运行C++进程以避免传输数据集
- 在虚拟文件系统中运行进程
- 检查是否已运行进程和通信的副本
- c++,总是运行进程或调用可执行文件
- 运行进程命令行
- 如何使用编程方法拦截linux上运行进程中调用的系统调用
- 使用c++获取当前运行进程中的X显示变量
- 获取当前运行进程的网络适配器
- 如何将ShellExecuteEx作为在父级退出后关闭的子级运行进程
- 在多核 (Linux) 中运行进程的命令行参数是什么