Now that you have helped me to programatically terminate an application,
http://www.codeguru.com/forum/showthread.php?t=484775
I now need to take the next step which is to terminate an application after an elapsed idle time of 5 minutes.

One good reference to get me started was:
http://www.codeguru.com/forum/showth...ight=idle+time

And here is a little console app that I wrote on the basis of that thread:
Code:
#include "stdafx.h"

#include <windows.h>
#include <iostream>
#pragma comment(lib, "user32.lib")
using namespace std;

int main()
{
	int n;
	double tickCount;
	double idleCount;
	LASTINPUTINFO lpi;
	lpi.cbSize = sizeof(LASTINPUTINFO);


	for(;;)
	{
		cout << "Enter number : ";
		cin >> n;
		if (n == 0) break;
		if (!GetLastInputInfo(&lpi)) {  }// failed, use GetLastError to get error code
		// lpi.dwTime now holds the tick count when last input was made
		tickCount = GetTickCount();
		idleCount = ( tickCount - lpi.dwTime );
		cout << "tickCount = " << tickCount << endl;
		cout << "lpi.dwTime = " << lpi.dwTime << endl;
		cout << "idleCount = " << idleCount << endl;
	}

	cout << "That's all folks!" << endl << endl;

	return 0;
}
Now the logical next step is to incorporate these ideas into an application timer that can be set to terminate the application at a specified (say 5 min) idle time. However, should the user interrupt the idle time with some action (application specific keyboard, mouse click, etc), then the timer should be reset.

The purpose of this application is to run on a network server share. To prevent simultaneous access of the application's database, the application has been configured to run a single instance at a time (see: http://support.microsoft.com/kb/243953). Should some user walk away from their workstation leaving the application open, the app would no longer be accessible from any other workstation on the network.

My current dilemma is that I am uncertain how to link the GetLastInputInfo() method with a timer that fulfills the above criteria.

Any help greatly appreciated.