MFC代码获取Windows服务启动/重启时间 [英] MFC code to get windows service start/restart time
问题描述
我创建了一个使用VC ++的Windows服务应用程序。我想得到它的星/重启时间。正如它在流程中显示的那样
explorer。 Pl参见随附的屏幕截图。
嗨Apurv Shah,
感谢您在这里发帖。
>>我使用VC ++创建了一个Windows服务应用程序。我想得到它的星/重启时间。与进程资源管理器中显示的相同。
你也可以使用
ShellExecute函数,包含Get-Eventlog Cmdlet或
WMI类,
Win32_NTLogEvent类。每次停止或启动服务时,服务控制管理器都会记录。例如:(Get-EventLog -LogName" System" -Source" Service Control Manager" -Message" Test Service" -Newest 1).TimeGenerated ;希望这可以帮到你。
最好的问候,
Sera Yu
I have created one windows service application using VC++. I want to get it's star/restart time. Just same as it shows in process explorer. Pl see the attached screen shot.
Hi Apurv Shah,
thanks for posting here.
>>I have created one windows service application using VC++. I want to get it's star/restart time. Just same as it shows in process explorer.
You could also use ShellExecute function with Get-Eventlog Cmdlet or WMI class with Win32_NTLogEvent class. The service control manager logs every time a service is stopped or started. For example:
(Get-EventLog -LogName "System" -Source "Service Control Manager" -Message "Test Service"-Newest 1).TimeGenerated;Hope this could be help of you.
Best Regards,
Sera Yu
这篇关于MFC代码获取Windows服务启动/重启时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!