I also had to do this recently, but my program design lent itself useful for this check (and yours might not).

I had a "kerrnel" for my application, where all data and interface calls got filtered through. When you requested to go to a certian view pane, the core said if you had permission... when you tried to add/delete/view data, the kernel said if you had permission.

That also made it really easy for me to reset the timer. Anytime a call into that subsystem, the timer was reset... after X minutes, I'd force a logout using a WM_TIMER.

Besides keeping track of user activity yourself, I'm not sure what you can do. You can monitor their idle time, but I'm not sure what level of security you need here; for me, idle time wasn't enough... I needed to know if actual activity was going on, not just mouse movements and such.