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