You mean you want to do inter process communication? Or you could just use a mutex to detect whether or not the first program is running (If its running, trying to acquire the mutex will fail as its already been obtained by the first program).

Or, you could just do it the way Unix programs have done it for years: Open a file when the first program runs. Write the process id to that file (or something else, for example, the date and time if you don't care about talking to it), and delete that file when the first program quits. The second program (the statistic program) will simply check if that file exists, and if so, will assume the first program is running (and perhaps check the contents to make sure the file isn't stale)