Previously when I wanted to create a click-through form, I was tempted to use platform invokes to set the extended window styles (GetWindowLong
/ SetWindowLong
in user32.dll
).
Just now I wanted to make it invisible to Alt+Tab window list, and I've found an example overriding CreateParams
to set the extended window style instead of using GetWindowLong
/ SetWindowong
.
Now I have this:
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x80000 /* WS_EX_LAYERED */ | 0x20 /* WS_EX_TRANSPARENT */ | 0x80/* WS_EX_TOOLWINDOW */;
return cp;
}
}
Now the apparent changes is not needing any platform invoke.
So my few questions:
- Will there be any functional differences on Windows? (Just to say I don't even have an XP machine to try now.)
- Now I don't have the platform invoke, will my program run on Mono on Linux/Mac? (If I could try now I wouldn't be asking you here.)
Control.CreateParams
appears on msdn and has an example of manipulating window styles. Then why some online "examples" and answers on StackOverflow tell people to useGetWindowLong
/SetWindowLong
?