poolban
June 1st, 1999, 02:25 AM
In our application, we would like to restrict user to fire the same job agian unless he comes out of it first. This means if the process PROGRAM_A.EXE is there in the NT Task Manager window, he can not start PROGRAM_A.EXE again. How do we do that? In other words, given a program name (ABCD.EXE for example), how do we check whether it is up there or not?
Any quick help is highly appreciated.
rgds.
There are a bunch of ways that you can accomplish this, but the most practical seems to be registering a unique window class name for your app window. In your InitInstance() method, call FindWindow() looking for any windows with that name...if you find one, the app must already be running, and you can switch that process to the foreground. Be sure to de-register the window class on exit though.
You should be able to find an example of this technique in the MSDN library that accompanies VC++ 6.0, but I don't remember exactly where...
Cheers!
Humble Programmer
,,,^..^,,,