聆听新进程:需要简单的解释
只是需要一点解释。
我在此处引用有关监听进程的问题。我还收到评论中提到的“访问被拒绝”错误,但不确定如何以管理员身份运行该示例的 WMI 服务。请有人指出我正确的方向。
这是我到目前为止所拥有的。
startWatch = new ManagementEventWatcher(new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace"));
startWatch.EventArrived += new EventArrivedEventHandler(ProcessEvent);
startWatch.Start();
private void ProcessEvent(object sender, EventArrivedEventArgs e)
{...}
just need a little explanation please.
I am referencing question here about listening to processes. I am also getting the "access denied" error as mentioned in the comments but not sure how to run the WMI service as administrator for the example. Someone please point me in the right direction.
Here is what I have so far.
startWatch = new ManagementEventWatcher(new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace"));
startWatch.EventArrived += new EventArrivedEventHandler(ProcessEvent);
startWatch.Start();
private void ProcessEvent(object sender, EventArrivedEventArgs e)
{...}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)