dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: process dieng

  1. #1
    Join Date
    Feb 2009
    Posts
    28

    process dieng

    hi,
    how i can know if the process die normally or abnormally in c#(if there is boolen variable in c# to it)?

  2. #2
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487

    Re: process dieng

    Have you tried the System.Management (WMI)?

    Event handler:
    Code:
    private void EventArrived(object source, EventArrivedEventArgs e)
            {
                // TODO
            }
    Start monitoring:
    Code:
    WqlEventQuery query = new WqlEventQuery(
                                      @"SELECT * 
                                      FROM __InstanceDeletionEvent WITHIN 1 
                                      WHERE TargetInstance ISA 'Win32_Process'");
                _watcher = new ManagementEventWatcher();
                _watcher.Query = query;
                _watcher.EventArrived += new EventArrivedEventHandler(EventArrived);
                _watcher.Start();
    Stop monitoring:
    Code:
    _watcher.Stop();
    HTH
    Busy

  3. #3
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: process dieng

    In the process itself, or from another process?
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)