2
我用下面的代码从任务栏隐藏...隐藏/显示任务栏从Windows应用程序中使用C#
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
}
}
但现在我想在任务栏再次显示我的计划 - 任何人都知道该怎么做它?
我们可以看到调用切换方法的代码吗? – Baldrick