Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: alt+tab event not working in Windows 7

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    4

    alt+tab event not working in Windows 7

    Hello,

    I hope with all the wisdom here someone has a solution to my problem:

    I am trying to detect Alt+Tab key event but no way. In Windows XP it is working properly but not in Windows 7. I implemented all the callbacks for the keyboard but with no luck. I receive Alt+F1 for instance but not the one I want. Is there any way to detect this?

    What I am trying to do is to detect when we gain focus and lose focus for my application and if so to minimize/maximize it. For this I also implemented the callback glutVisibilityFunc but it seems that it does not receive any event when I am pressing alt+tab or pressing the Windows-key and clicking over another application.

    I am a bit desperate right now so any help would be appreciated

    Thanks a lot!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,712

    Re: alt+tab event not working in Windows 7

    What I am trying to do is to detect when we gain focus and lose focus for my application and if so to minimize/maximize it.
    I'm pretty sure that there are OS calls that you can do to check that. Listening for Alt-Tab isn't enough anyway, because they might not switch away from your application.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Jan 2007
    Posts
    964

    Re: alt+tab event not working in Windows 7

    Hmmm - this definitely works using the Windows API and also with SDL; smells a little like a GLUT bug.

    Alfonse is right though, you don't want to test for Alt-Tab but instead for the specific events you mentioned - losing focus or when minimized; the equivalent of a WM_ACTIVATE message in the Windows API.

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    4

    Re: alt+tab event not working in Windows 7

    Thanks for the fast answers I have all my application management done with glut right now so how could I change the code to be able to receive windows events without changing what I have?

  5. #5
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,712

    Re: alt+tab event not working in Windows 7

    These question are really about Windows, not OpenGL on Windows. You would be more likely to get answers on a Windows forum or by looking through Microsoft's documentation.

    I don't have the answers, but since GLUT hides all of the windowing system details, it's unlikely you will be able to make it work while still using GLUT.

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2010
    Posts
    4

    Re: alt+tab event not working in Windows 7

    Thanks Alfonse for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •