Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent "Access Denied" error in actions2.py #100

Closed
chilimangoes opened this issue Sep 3, 2015 · 1 comment
Closed

Intermittent "Access Denied" error in actions2.py #100

chilimangoes opened this issue Sep 3, 2015 · 1 comment
Labels
Bug Unexpected behavior from existing features.

Comments

@chilimangoes
Copy link
Collaborator

After merging the development branch into my local copy, I started getting an occasional Access Denied error on startup, which I traced to this line in actions2.py failing:

win32gui.SystemParametersInfo(win32con.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 1)

After a little googling, it appears that SPI_SETFOREGROUNDLOCKTIMEOUT will fail if any of the conditions are not true:

  • The process is the foreground process.
  • The process was started by the foreground process.
  • The process received the last input event.
  • There is no foreground process.
  • The foreground process is being debugged.
  • The foreground is not locked (see LockSetForegroundWindow).
  • The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).
  • No menus are active.

It doesn't happen all the time, and I can't identify a pattern to it yet. I'm also not sure what the purpose of that line is or what the impact to the rest of actions2.py is if it fails. For now, I've wrapped it in a try/except so that it won't break the whole start up process.

try:
    win32gui.SystemParametersInfo(win32con.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 1)
except Exception, e:
    print(e)
    print(sys.exc_info()[0])
@synkarius
Copy link
Collaborator

That is t4ngo's suggested solution to the 64-bit focus window executable problem (which Daanzu fixed). It is no longer necessary and has been commented out in the most recent commit.

@LexiconCode LexiconCode added the Bug Unexpected behavior from existing features. label Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected behavior from existing features.
Projects
None yet
Development

No branches or pull requests

3 participants