I created my own on screen keyboard with special features.
I'm using override
methods ShowWithoutActivation
and CreateParams
for preventing my Form getting focus (according to this stackoverflow question).
protected override bool ShowWithoutActivation
{
get { return true; }
}
protected override CreateParams CreateParams
{
get
{
CreateParams param = base.CreateParams;
param.ExStyle |= 0x08000000;
return param;
}
}
But after a few Hide()
and Show()
my Form is again focusable.
To fix it I need to restart application, but it is of course poor solution.
Is it possible to do without restart?
Showing Form after being hidden without giving it focus not help. My application can just be focused again.
I'm noticed that in most cases it happens randomly, but in one of them always: if I show my application after right mouse click on NotifyIcon in tray and choose item from ContextMenuStrip. OnClick I simply call show function.