How can I detect if a program is started?

  • Thread starter Thread starter jmDesktop
  • Start date Start date
J

jmDesktop

I want to create my C# program to run in the background and detect
when a program starts. In an interactive program, I know I can
iterate through an array of Processes to find my process if I click a
button, for example. But, I cannot find the best way to run my C#
program in the background waiting for a program to start

The program just needs to stay in the background and when someone say
opens notepad, I can show a messagebox saying "You opened notepad."

All I saw was a gigantic set of code with hooks. I don't know if
that's the best way to do it. My purpose behind this is to keep
someone from running a third party program more than one time because
it is frying everything. One thought was to just start the program
from my c# program, but I didn't like it. Someone could always bypass
it and just start the program directly.

Thank you for any help.
 
Hello jmDesktop,

The most ellegant way (and probably the only really reliable) would be with
hooks...

Take a look at EasyHook at CodePlex... It could be a good start:
http://www.codeplex.com/easyhook

Cheers,
Caio Proiete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top