The other way is enumerating the processes until you find B, but attention!
If the user renames the exe, you are finished.
The best (I think) way to enumerate processes is described here:
http://support.microsoft.com/support/kb/articles/q175/0/30.asp
It gives you a function which works on both 9x and NT.
Gabriele Trombetti
Quote:
> Hi. Can I terminate a process using it's module name alone? I know how
> to terminate a process if it has a window (FindWindow,
> GetWindowThreadProcessId, OpenProcess, TerminateProcess), but what if
> the program doesn't create a window? I created two programs. Program A
> needs to close Program B at a certain time, but Program B doesn't create
> a window. I would rather find a way for Program A to close Program B
> instead of changing Program B to work with the above method. Thanks.