It seems like checking the window style did the trick:
public static bool hasWindowStyle(Process p)
{
IntPtr hnd = p.MainWindowHandle;
UInt32 WS_DISABLED = 0x8000000;
int GWL_STYLE = -16;
bool visible = false;
if (hnd != IntPtr.Zero)
{
UInt32 style = GetWindowLong(hnd, GWL_STYLE);
visible = ((style & WS_DISABLED) != WS_DISABLED);
}
return visible;
}
This returns true if:
- The process doesn't have a Window Style for user input
I've done a little testing and as of now at least this seems to filter out the processes that are running behind the scenes pretty good.
I guess this only work on Windows though.