Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 230553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:51:32+00:00 2026-05-11T19:51:32+00:00

I have some services that an application needs running in order for some of

  • 0

I have some services that an application needs running in order for some of the app’s features to work. I would like to enable the option to only start the external Windows services to initialize after the application is launched. (as opposed to having them start automatically with the machine and take up memory when the application is not needed)

I do not have access to the exe’s code to implement this, so ideally I would like to write a C# .Net Windows service that would monitor when an exe is launched.

What I’ve found so far is the System.IO.FileSystemEventHandler. This component only handles changed, created, deleted, and renamed event types. I don’t expect that a file system component would be the ideal place to find what I’m looking for, but don’t know where else to go.

Maybe I’m not searching with the right keywords, but I have not yet found anything extremely helpful on Google or here on stackoverflow.com.

The solution would be required to run on XP, Vista, and Win 7 when it comes…

Thanks in advance for any pointers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:51:32+00:00Added an answer on May 11, 2026 at 7:51 pm

    From this article, you can use WMI (the System.Management namespace) in your service to watch for process start events.

     void WaitForProcess()
    {
        ManagementEventWatcher startWatch = new ManagementEventWatcher(
          new WqlEventQuery("SELECT * FROM Win32_ProcessStartTrace"));
        startWatch.EventArrived
                            += new EventArrivedEventHandler(startWatch_EventArrived);
        startWatch.Start();
    
        ManagementEventWatcher stopWatch = new ManagementEventWatcher(
          new WqlEventQuery("SELECT * FROM Win32_ProcessStopTrace"));
        stopWatch.EventArrived
                            += new EventArrivedEventHandler(stopWatch_EventArrived);
        stopWatch.Start();
    }
    
      static void stopWatch_EventArrived(object sender, EventArrivedEventArgs e) {
        stopWatch.Stop();
        Console.WriteLine("Process stopped: {0}"
                          , e.NewEvent.Properties["ProcessName"].Value);
      }
    
      static void startWatch_EventArrived(object sender, EventArrivedEventArgs e) {
        startWatch.Stop();
        Console.WriteLine("Process started: {0}"
                          , e.NewEvent.Properties["ProcessName"].Value);
      }
    }
    

    WMI allows for fairly sophisticated queries; you can modify the queries here to trigger your event handler only when your watched app launches, or on other criteria. Here’s a quick introduction, from a C# perspective.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a winform application that uses some referenced web services to get data.
Problem: We have a web app that calls some web services asynchronously (from the
Some existing web services I consume have methods that look something like this: List<Employee>
I have client application that uses WCF service to insert some data to backend
I have some reports in SQL Server Reporting Services 2005 that I need to
We will develop a web site that will have some free services and we
I have found some libraries or web services in PHP that does the job.
I have a web app that uses some backend servers (UNC, HTTP and SQL).
I have some special parameters to all my wcf service methods that are handled
We have a service that has some settings that are supported only over net.tcp.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.