Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if a window is visible or not using C#

Tags:

c#

user32

I have a Console / Form hybrid application in C#, and at the moment, i have to rely on user32.dll to show/hide the console window. But I can't seem to find a way in which i can determine if the console window is hidden or visible (without storing the value myself)

like image 233
Mike Avatar asked Apr 16 '10 20:04

Mike


1 Answers

IsWindowVisible Function:

The IsWindowVisible function retrieves the visibility state of the specified window.

C# Signature from pinvoke.net:

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindowVisible(IntPtr hWnd);
like image 199
dtb Avatar answered Sep 21 '22 03:09

dtb