<p>There is some documentation on the internet that shows that Windows changes the behavior of the NotifyIcon.BalloonTipShown command if the user is currently idle and this is <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=343411&amp;SiteID=1" rel="nofollow noreferrer">detected by checking for keyboard and mouse events</a>. I am currently working on an application that spends most of its time in the system tray, but pop-ups up multiple balloon tips from time to time and I would like to prevent the user from missing any of them if they are currently away from the system. Since any currently displayed balloon tips are destroyed if a new one is displayed, I want to hold off on displaying them if the user is away.</p>

<p>As such, is there any way to check to see if the user is currently idle if the application is minimized to the system tray?</p>

[{'answer_id': 19187, 'author': 'lubos hasko', 'author_id': 275, 'author_profile': 'https://Stackoverflow.com/users/275', 'pm_score': 1, 'selected': False, 'text': '<p><strong>Managed code</strong></p>\n\n<p>Check position of the mouse every second. If there are new messages for user, hold on to them until you detect any move with the mouse.</p>\n\n<p><strong>Unmanaged code</strong></p>\n\n<p>See <a href="http://weblogs.asp.net/jdanforth/archive/2006/06/21/454219.aspx" rel="nofollow noreferrer">Detecting Idle Time with Mouse and Keyboard Hooks</a></p>\n'}, {'answer_id': 19188, 'author': 'Mark Cidade', 'author_id': 1659, 'author_profile': 'https://Stackoverflow.com/users/1659', 'pm_score': 3, 'selected': True, 'text': '<p>How about the Win32 <a href="http://www.codeproject.com/KB/cs/GetIdleTimeWithCS.aspx" rel="nofollow noreferrer">LASTINPUTINFO</a> function?</p>\n\n<pre><code>using System.Runtime.InteropServices;\n\n[DllImport("User32.dll")] \nstatic extern bool GetLastInputInfo(ref LASTINPUTINFO plii);\n\nstruct LASTINPUTINFO \n{\n    public uint cbSize;\n    public uint dwTime;\n}\n</code></pre>\n'}, {'answer_id': 20002, 'author': 'rjzii', 'author_id': 1185, 'author_profile': 'https://Stackoverflow.com/users/1185', 'pm_score': 0, 'selected': False, 'text': "<p>Thanks for the responses, I ended up going with the GetLastInputInfo function as it is pretty straight forward to implement in the application I'm working on.</p>\n"}]
['https://Stackoverflow.com/questions/19185', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1185/']