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

  • SEARCH
  • Home
  • 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 8977429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:22:08+00:00 2026-06-15T19:22:08+00:00

Try to create a windows service with VS 2012. By default, there are 3

  • 0

Try to create a windows service with VS 2012. By default, there are 3 methods for the service:

Constructor(say MyService)
OnStart
OnStop

but when I put some code in Constructor, looks like it only running one time.

What I want is: when an app started from windows, for example, notepad.exe, I can capture it.
Should I put a dead loop in the constructor to monitor process list? I thought Service should be always on like a dead loop.
So when an app start it, how to capture it in MyService?

  • 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-06-15T19:22:09+00:00Added an answer on June 15, 2026 at 7:22 pm

    Should I put a dead loop in the constructor to monitor process list?

    No, that goes in OnStart(). Basic pseudo-code is:

    • OnStart:
      • Set up monitoring
      • Start it
    • Monitoring:
      • while (true) monitor processes
      • if(stop signal) exit
    • OnStop
      • Give stop signal to monitoring object
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a simple windows-service, but when i try to start it it
I have a Windows service (C#) where I create multiple threads which will try
I try to create a very simple app using windows API. I've done some
When I try to create a COM object in VB script on a Windows
I try create a map for open ~/.vimrc, but open the ~/.vimrc only when
I try to create styles with first-child and last-child items but I encountered a
I wrote my first windows service. Create WS project Rename Service Drag a timer
i cannot create file in my windows service and this is error error In
I am trying to create an install for a windows service package. I had
I'm trying to create an installer for a Windows Service I developed. This installer

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.