hy,
I've got a quite simple application: one windows form that consists of a
button, and as soon as the user hits the button a second form shall appear.
The difficult thing about it is that I want the new form to be created as
"deactivated" - that means that the second form has an editbox in it, and
this must NOT have the focus - instead, the calling form shall keep its
focus.
One simple way would be to immediately set focus back after the second form
got it, but this won't work in the future for me when I will extend my app.
So I'm looking for a way to immediately create a window that doesn't have
focus.
I've already tried overriding the CreateParams-method like this (the
WS_EX_NOACTIVATE style here is the one from CreateWindowEx in win32-sdk):
protected override CreateParams CreateParams
{
get
{
const int WS_EX_NOACTIVATE = 0x08000000;
CreateParams myParams = base.CreateParams;
myParams.ExStyle = myParams.ExStyle | WS_EX_NOACTIVATE;
return myParams;
}
}
Or do I have to override a method like myForm.Show(), or myForm.Activated()
(because the new window gets focus as soon as I call myForm.Show())
I really appreciate any hints that could lead to a solution,
thx in advance,
ekim!