Activation Event missing in Windows
Posted: 09-10-2006, 10:06 AM
I don't have Windows Vista currently available. Perhaps one of you might
afford the time to check this:
There's a bug in current Windows versions: When you start a program taking
some time to initialize, Windows is sending a first Activate event to that
program even if it is *not* activated at all.
This is the case when some other program has been activated by the user
between clicking the new program's icon and before the newly loaded program
has started its message queue loop.
This bug is particularly annoying on always-on-top applications, e.g. having
a semi-transparent effect changing its transparency depending on being
active.
Particularly .NET applications suffer from this bug as it often takes some
time to initilize the CLR.
Steps to reproduce the error:
* Open any application (e.g. Notepad), let's call it 'A'.
* Click the icon of any test program (='B') taking
some seconds to boot (e.g. MS Word).
* Before B's window appears on screen, activate A.
=> Although A is displayed as being active and has the keyboard focus, in
the task bar B appears as being active. Moreover, B has received an Activate
event making it believe it has the focus.
This is a Windows core bug, so a test program logging the Activate event can
easily be written in any language using any framework. In Windows API wou
might want to catch the WM_ACTIVATE event, in VB or .NET you may use the
Form_Activate event as well.
It's important to have the test program take some time before it creates the
message queue loop. In C# this is what I did:
[STAThread]
static void Main()
{
Thread.Sleep(3000);
Application.Run(new Form1());
}
private void Form1_Activated(object sender, System.EventArgs e)
{
lb.Items.Add("Activated");
}
Does this error still persist in Windows Vista? Then I suggest it should be
fixed now. There is no situation possible where fixing this bug may break
existing programs.
One more thing: When testing, I suggest you try to not have the windows of
program A and B overlap. Otherwise you might miss the effect when logging
events into B's window.
TIA,
Axel Dahmen



Hybrid Mode


Posts: n/a