Process Monitor Suggestions

  • Thread starter Thread starter Me
  • Start date Start date
M

Me

I am looking for some suggestions or sample code for an application the sits
in the system tray (a TSR) and then executes code that I specify when a
certain executable is launched. As an example, an TSR that pops a Dialog Box
up in the middle of the screen when winword.exe is launched.

Any ideas,
John
 
Ideally, you don't want a system tray program to sit there all the time & hog
valubule system resources, but a Windows servive that runs in the background
instead.

Here's a function that will tell you if MS Word is running:

Private Function IsWordRunning() As Boolean
Dim pWord As System.Diagnostics.Process() =
System.Diagnostics.Process.GetProcessesByName("winword")
If pWord.Length >= 1 Then
Return True
Else
Return False
End If
End Function

Note: 'Winword' is all lowercase

I hope this is of help to you
 
Thanks for the reply. I understand what your saying but I don't want to
check if something is already running, I want to be notified when it is
launched, so I can perform other actions upon launching of the application.

Thanks,

John
 
Yes, but if you create a Windows service that fires every few seconds then
you will be able to do exactly what you want & it will consume far less
memory than a system tray application

In the service 'OnStart' event, set the timer running. In the timer 'Tick'
event, call the function I supplied to check if MS Word is running...
Finally, on the 'OnStop' event, stop the timer.

If you install it as a 'Local' service then it will run with whoever is
logged on to the machine.
 
Have you ever played computer games? Most controllers, Microsoft Sidewinder,
Belkin Nostromo and all the newer ones have a Game Profiler that runs in the
system tray. When a certain executable, game, is launched it automatically
loads a profile (key mapping file) into the gaming controller. There could
be 10 or 15 different executables, in my case 35, each associated with a
different key mapping file that needs loaded into the controller when the
particular executable they are associated with is launched. This needs to
happen in a seconds time so an app that polls is probably not going to cut
it. An I still way off base here?

Thanks,
John
 
Quite honestly I never play games. I have been programming for 25 years & are
a professional programmer by trade.

For your key mappings: You could hold the info in a XML file, which could be
read quite easily.

If you still want to write a System Tray project then just add a module &
use it as your start up (sub main).

Call your form (hidden), but you tray icon visible & in the form load event
enable the timer.

Trigger your timer at a given interval. In the Timer Tick Event, do your
stuff.
 
ok, we're on the same page a little better now. Getting back to my first
post, I'm still looking for sample code or a document/web page on how to
tell in code if an application is launched.

Thanks for your time,
John
 
Back
Top