Yes.
The logic is basically thus:
I get the MainWindowID by looping through all the windows ( using
findwindowex ) and then comparing the caption to what I know it should
be using GetWindowText.
On a timer set to fire every 5 seconds
As long as the program is running ( MainWindowID !=0 )
I get the activeWidowID ( using GetForegroundWindow )
If MainWindowID = ActiveWindowID, then I know they are using the
program and set failurecount = 0
<here is the part I can't figure out>
If the ActiveWindowID != MainWindowID then I know that they MIGHT
be using the program
In testing, I made sure the active window was one of the secondary
windows created by the main program. I tried checking the parent or
owner of the activewindow to see if either matches the MainWindowID,
but the parent is 0 and the owner is itself. I know that the program
in question created the secondary windows, but I cannot figure out how
to determine if the active window is one of these secondary windows
using the WindowsAPI.
</here is the part I can't figure out>
if failurecount > 20, then I assume they havent used the software in
the last minute and PostMessage to the MainWindowID to WM_CLOSE it
Rob Schieber - 29 Dec 2005 17:51 GMT
> Yes.
>
[quoted text clipped - 24 lines]
> if failurecount > 20, then I assume they havent used the software in
> the last minute and PostMessage to the MainWindowID to WM_CLOSE it
It sounds like you are a little unsure of exactly what window you are
trying to access. Have you tried using Spy++ to isolate the window you
need?

Signature
Rob Schieber