ForeGroundWindow Issue

  • Thread starter Thread starter Jerod Houghtelling
  • Start date Start date
J

Jerod Houghtelling

Hi all,

Does anybody know of a way to have a C# PPC/WM application receive
notification when a window is brought to the foreground. Catching the
forms Deactivate and LostFocus events are not good enough. I need to
be able to globally catch the event when an window is brought to the
foreground. Currently I'm doing this with GetForegroundWindow() and a
Timer checking to see if the current foreground window is different
then the last time I checked. This seems extremely inefficient so I
was hoping that maybe I could register an event or use
WaitForSignalObject if I knew the event name.

Any help would be extremely appreciated!

Thanks,
Jerod
 
There's no event fired. That event would be constantly firing, if there
were. What are you trying to achieve with this (boils down to why you need
to know that a change in the foreground window is being made)? There might
be another way or a different sort of suggestion that we could offer.

Paul T.
 
There's no event fired. That event would be constantly firing, if there
were. What are you trying to achieve with this (boils down to why you need
to know that a change in the foreground window is being made)? There might
be another way or a different sort of suggestion that we could offer.

Paul T.

I'm trying to mimic HHPs EZMenu program. (Looks and acts like the
Programs menu but the start icon must be hidden from ALL programs.) My
requirement is that the task bar must be visible, but the start icon
hidden. It is also not sufficient enough for me to make the window
full screen. I'm referring to removing the start icon because it
essentially locks the task bar. Plus I don't want the user thinking
that it is locked up if I just disable the task bar because the start
icon is still visible.
 
I'm afraid that I'm not familiar with it. It's a shell replacement
(explorer.exe is *not* in the registry Init keys while this program is in
charge)? I can certainly see how to accomplish *that* with a clone of the
explorer and suitable changes to the code (native, of course).

So, you need to know who is in front because you want to indicate on your
taskbar who is active by showing the 'button' in the down state or something
of that sort? It appears to me that the window manager automatically
notifies the shell of those transitions, but not any other applications.
The mechanism for asking for them is pretty opaque...

Paul T.
 
I've just found the code in the window manager that does that and it *does*
only send the message to the task bar. Seems like that's probably the best
way to go (replace the shell), if this is intended for a device where you
are in control of what should be installed on the device at all times.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
 
Ah, and there's where the taskbar is registered with the window manager,
RegisterTaskBar(). Sorry, only one task bar allowed per system (and there
are restrictions mentioned in the help).

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
I've just found the code in the window manager that does that and it
*does* only send the message to the task bar. Seems like that's probably
the best way to go (replace the shell), if this is intended for a device
where you are in control of what should be installed on the device at all
times.

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
I'm afraid that I'm not familiar with it. It's a shell replacement
(explorer.exe is *not* in the registry Init keys while this program is in
charge)? I can certainly see how to accomplish *that* with a clone of
the explorer and suitable changes to the code (native, of course).

So, you need to know who is in front because you want to indicate on your
taskbar who is active by showing the 'button' in the down state or
something of that sort? It appears to me that the window manager
automatically notifies the shell of those transitions, but not any other
applications. The mechanism for asking for them is pretty opaque...

Paul T.

Jerod Houghtelling said:
On Aug 29, 3:58 pm, "Paul G. Tobey [eMVP]" <p space tobey no spam AT
no instrument no spam DOT com> wrote:
There's no event fired. That event would be constantly firing, if
there
were. What are you trying to achieve with this (boils down to why you
need
to know that a change in the foreground window is being made)? There
might
be another way or a different sort of suggestion that we could offer.

Paul T.



Hi all,

Does anybody know of a way to have a C# PPC/WM application receive
notification when a window is brought to the foreground. Catching the
forms Deactivate and LostFocus events are not good enough. I need to
be able to globally catch the event when an window is brought to the
foreground. Currently I'm doing this with GetForegroundWindow() and a
Timer checking to see if the current foreground window is different
then the last time I checked. This seems extremely inefficient so I
was hoping that maybe I could register an event or use
WaitForSignalObject if I knew the event name.

Any help would be extremely appreciated!

Thanks,
Jerod

I'm trying to mimic HHPs EZMenu program. (Looks and acts like the
Programs menu but the start icon must be hidden from ALL programs.) My
requirement is that the task bar must be visible, but the start icon
hidden. It is also not sufficient enough for me to make the window
full screen. I'm referring to removing the start icon because it
essentially locks the task bar. Plus I don't want the user thinking
that it is locked up if I just disable the task bar because the start
icon is still visible.
 
Back
Top