设置流程窗口的可见性

时间:2015-12-30 23:13:27

标签: c#

要检查窗口是否可见,我必须使用:

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindowVisible(IntPtr hWnd);

但我如何改变可见度呢? 真/假

编辑:

隐藏作品:

            Process P;
            P = Process.GetProcessesByName("javaw")[2];
            ShowWindow(P.MainWindowHandle, 0);

但显示不是:

            Process P;
            P = Process.GetProcessesByName("javaw")[2];
            ShowWindow(P.MainWindowHandle, 5);

编辑:

            ShowWindow(FindWindow(null, "WINDOWNAME"), 0);

0 invisibvle 5可见

WORKS

1 个答案:

答案 0 :(得分:3)

您可以使用ShowWindow

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommands nCmdShow);