After COM API call, getting EOSError Exceptions (access denied) but only when switching users or Locking the station on Windows 7

孤人 提交于 2019-12-06 06:30:58
Robert Oschler

I found the problem. It's because I am calling Controls.TMouse.GetCursorPos() on a timer to update the tag cloud view I mentioned in my original post. That function will raise an Exception if the current desktop is unavailable, like when you switch to another user account or Lock the station. This Stack Overflow post covers the issue from a general WinAPI context for the GetCursorPos() function.

Call to TMouse.GetCursorPos sometimes fails with "A call to an OS function failed"

In contrast to the author of the above post, it only happens to me on Windows 7 and not on Windows XP. I need to change my code to detect when the active desktop is no longer available and suppress that call using the session lock/unlock/logon/logoff detection techniques covered in the post linked below as suggested to me by TLama. See DavidHeffernan's answer:

What does an application have to do in order "support" Remote Desktop Services?

If possible for your users to change your program to compatibility mode XP SP3 that may eliminate those errors. This is obviously a workaround.

You can use processmonitor along with filemon in order to see what is going on on windows: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

for the full suite: http://technet.microsoft.com/en-us/sysinternals/bb842062

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!