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 :slight_smile:

Thanks a lot!

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.

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.

Thanks for the fast answers :slight_smile: 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?

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.

Thanks Alfonse for your help :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.