Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Stephane Baillargeon
Wed, 26 Mar 2003 15:00
ALT+TAB Detection
Author: Stephane Baillargeon
Date: Wed, 26 Mar 2003 15:00
Date: Wed, 26 Mar 2003 15:00
13 lines
1475 bytes
1475 bytes
Is there a way to detect the ALT+TAB app switcher and control it? Explanation: We are developping a large scale video game. Durring gameplay, we want the user to be able to hit the ALT+TAB keys in order to change the current task. Our problem is that the game's threads are still running in the background and it consumes a massive ammount of memory rendering the PC pretty slow. Is there a way to detect this combination of keys in a WinAPI point of view and stop the task switch momentarly to do some proccessing like stopping the game's threads? Thank you.
Re: ALT+TAB Detection
Author: Early Ehlinger
Date: Sat, 29 Mar 2003 21:52
Date: Sat, 29 Mar 2003 21:52
34 lines
2209 bytes
2209 bytes
"Stephane Baillargeon" <sbaillargeon@microids.com> wrote:
> Is there a way to detect the ALT+TAB app switcher and control it?
>
> We want the user to be able to hit the ALT+TAB keys in order to
> change the current task. Is there a way to detect this combination
> of keys in a WinAPI point of view and stop the task switch
> momentarly to do some proccessing like stopping the
> game's threads?
I think the answer is no, but that's not to say you can't have the same
effect :)
From MSDN:
The WM_ACTIVATEAPP message is sent when a
window belonging to a different application
than the active window is about to be activated.
The message is sent to the application whose
window is being activated and to the application
whose window is being deactivated.
wParam
Specifies whether the window is being activated or
deactivated. This parameter is TRUE if the window
is being activated; it is FALSE if the window is
being deactivated.
So all you need to do is catch WM_ACTIVATEAPP. If wParam is TRUE, resume all
your threads. Otherwise, suspend them.
--
-- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697
-- www.respower.com -- 500+ GHz Supercomputer Starting At USD$0.50/GHz*Hour
Re: ALT+TAB Detection
Author: Stephane Baillargeon
Date: Mon, 31 Mar 2003 12:39
Date: Mon, 31 Mar 2003 12:39
43 lines
2536 bytes
2536 bytes
Thanks alot. Really appreciated. "Early Ehlinger" <early@respower.com> wrote in message news:3e86159e@newsgroups.borland.com... > "Stephane Baillargeon" <sbaillargeon@microids.com> wrote: > > Is there a way to detect the ALT+TAB app switcher and control it? > > > > We want the user to be able to hit the ALT+TAB keys in order to > > change the current task. Is there a way to detect this combination > > of keys in a WinAPI point of view and stop the task switch > > momentarly to do some proccessing like stopping the > > game's threads? > > I think the answer is no, but that's not to say you can't have the same > effect :) > > From MSDN: > > The WM_ACTIVATEAPP message is sent when a > window belonging to a different application > than the active window is about to be activated. > The message is sent to the application whose > window is being activated and to the application > whose window is being deactivated. > > wParam > > Specifies whether the window is being activated or > deactivated. This parameter is TRUE if the window > is being activated; it is FALSE if the window is > being deactivated. > > So all you need to do is catch WM_ACTIVATEAPP. If wParam is TRUE, resume all > your threads. Otherwise, suspend them. > > -- > -- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697 > -- www.respower.com -- 500+ GHz Supercomputer Starting At USD$0.50/GHz*Hour > > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads