Hi Peter,
Nowadays I've another piece of code (more complex but based on a single timer - unfortunately something I can't publish for now).
I revisited the code and GetLastInputInfo documentation and I think now I can see why I wrote it like that then:
GetLastInputInfo checks input only and a mouse movement is not considered an input (if it's then I misinterpreted it and never tested)
Cetin
>Cetin,
>What would you do nowadays? My feeling says that only GetLastInputInfo should be tested if it's w2k or later. But I'm open to disagreement on this one.
>
>>Peter,
>>I'm away from the code but as far as I can remember off the top of my head:
>>I probably thought "if is2K" check vs directly calling GetCursorPos() didn't have much impact (few milliseconds maybe) and to make sure ptLastPoint property is initialized (generally leaving such values at their default .f., setting in code).
>>Also that code is old and what I came up with then.
>>Cetin
>>
>>>Hi Cetin,
>>>
>>>Thanks for your elaboration on the screensaver questions.
>>>
>>>My first question is (in other words): Microsoft has introduced the api-call GetLastInputInfo to enable developers to check the last-input moment of the whole system, also as THE means to check since when the system is idle. Why is GetCursorPos() done earlier in your code, even if it is win2k or xp?
>>>
>>>>Hi Peter,
>>>>1) Couldn't understand this question. It's checked for all. Activity accepted to occur with either mouse movement or a keypress. For mouse checking GetCursorPos() and saving last point where mouse is.
>>>>2) Checking screensaver because if a screensaver is set it could do the work for me. Then I check if a screensaver state was entered.
>>>>3) No the code pasted there is not complete. Just the core pieces.
>>>>
>>>>Here is a more detailed version (not full but near):
>>>[snip]