473,756 Members | 6,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I detect if a program is started?

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.
Aug 28 '08 #1
1 2713
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
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.

Aug 28 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4016
by: Stephane Belzile | last post by:
Is there a way I can detect in vb.Net the power has switched to a UPS unit in case of power failure? Thanks
0
1399
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different documents (txt, MS Office files, pdf, pictures,…) from inside my app. It must start the file with the adequate external program (Notepad, MS Office programs, Acrobat Reader, some Picture viewer,... ) and be notified when this programs closes the...
23
15599
by: Michel Bany | last post by:
I am trying to parse responseXML from an HTTP request. var doc = request.responseXML; var elements = doc.getElementsByTagName("*"); the last statement returns an empty collection when running from IE6. It returns the expected collection when running under Firefox or Mozilla. Anybody can explain ? Michel.
6
5167
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different documents (txt, MS Office files, pdf, pictures,…) from inside my app. It must start the file with the adequate external program (Notepad, MS Office programs, Acrobat Reader, some Picture viewer,... ) and be notified when this programs closes the...
5
11258
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough to avoid the overhead of writing to the console if it is not visible, eg I am running inside a WinForm application. thanks
7
2779
by: Rob | last post by:
I do not want multiple instances of a vb.net program running concurrently... How may I detect this ? Thanks
0
764
by: Jason Gurtz | last post by:
What I'd like to do is have a program where it displays a graphical form if a user double clicks from within explorer but just does some processing without any interface if started via command line or shortcut with cmd /k or cmd /c. Is this possible? ~Jason --
2
1810
by: bz | last post by:
Hi, I need to detect at runtime if the application was started from VS 2005. Is it possible? Also, how can I know at runtime of app is built for Debug or Release? Thanks
0
3284
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
My program needs to do X when someone 'starts using' their Windows user account, and it should do Y when they 'stop using' their Windows user account. By 'starts using' I mean they log on, unlock the desktop, resume from hibernate/sleep, or resume a session that was paused via Switch User. By 'stop using' I mean they lock the desktop, initiate a hibernate/sleep , or choose Switch User while logged on. For context, the program is a parental...
0
9973
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9779
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9645
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3276
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2612
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.