我使用以下代码从任务栏隐藏...
private const int SW_HIDE = 0x00;
private const int SW_SHOW = 0x05;
private const int WS_EX_APPWINDOW = 0x40000;
private const int GWL_EXSTYLE = -0x14;
private const int WS_EX_TOOLWINDOW = 0x0080;
[DllImport("User32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("User32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
bool isShow = true;
private void toggle(Process p)
{
if (isShow)
{
isShow = false;
SetWindowLong(p.MainWindowHandle, GWL_EXSTYLE, WS_EX_APPWINDOW);
ShowWindow(p.MainWindowHandle, SW_SHOW);
ShowWindow(p.MainWindowHandle, SW_HIDE);
//Hide: working
}
else
{
isShow = true;
SetWindowLong(p.MainWindowHandle, GWL_EXSTYLE, WS_EX_APPWINDOW);
ShowWindow(p.MainWindowHandle, SW_HIDE);
ShowWindow(p.MainWindowHandle, SW_SHOW);
//Show: not working
}
}
但现在我希望任务栏再次显示我的程序 - 有人知道该怎么做吗?