Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何防止任务栏显示WPF非全屏窗口? 我有一个大的C++代码库,它带有运行Windows的GUI。 其一部分应通过顶部显示的WPF窗口进行交换。 窗口设置如下: <Window WindowState="Normal" WindowStyle="None" ShowInTaskbar="False" AllowsTransparency="True" /> Windows::Window^ w = window(); Windows::Interop::WindowInteropHelper iHelp(w); iHelp.Owner = System::IntPtr(_parentHwnd); w->Show();_Wpf_Window_Command Line Interface - Fatal编程技术网

如何防止任务栏显示WPF非全屏窗口? 我有一个大的C++代码库,它带有运行Windows的GUI。 其一部分应通过顶部显示的WPF窗口进行交换。 窗口设置如下: <Window WindowState="Normal" WindowStyle="None" ShowInTaskbar="False" AllowsTransparency="True" /> Windows::Window^ w = window(); Windows::Interop::WindowInteropHelper iHelp(w); iHelp.Owner = System::IntPtr(_parentHwnd); w->Show();

如何防止任务栏显示WPF非全屏窗口? 我有一个大的C++代码库,它带有运行Windows的GUI。 其一部分应通过顶部显示的WPF窗口进行交换。 窗口设置如下: <Window WindowState="Normal" WindowStyle="None" ShowInTaskbar="False" AllowsTransparency="True" /> Windows::Window^ w = window(); Windows::Interop::WindowInteropHelper iHelp(w); iHelp.Owner = System::IntPtr(_parentHwnd); w->Show();,wpf,window,command-line-interface,Wpf,Window,Command Line Interface,_parentHwnd是本机应用程序的HWND。 如前所述,应用程序总是全屏显示。 现在单击WPF窗口时,将显示Windows任务栏。 如何防止任务栏出现?我使用了这个类(在网上的某个地方发现了一个想法)来隐藏/显示任务栏: public static class Taskbar { [DllImport("user32.dll")] private static extern int FindWindow(string className, string windowText)

_parentHwnd是本机应用程序的HWND。 如前所述,应用程序总是全屏显示。 现在单击WPF窗口时,将显示Windows任务栏。 如何防止任务栏出现?

我使用了这个类(在网上的某个地方发现了一个想法)来隐藏/显示任务栏:

public static class Taskbar
{
    [DllImport("user32.dll")]
    private static extern int FindWindow(string className, string windowText);
    [DllImport("user32.dll")]
    private static extern int ShowWindow(int hwnd, int command);

    private const int SW_HIDE = 0;
    private const int SW_SHOW = 1;

    public static int Handle
    {
        get
        {
            return FindWindow("Shell_TrayWnd", "");
        }
    }
    public static int StartHandle
    {
        get
        {
            return FindWindow("Button", "Start");
        }
    }

    public static void Show()
    {
        ShowWindow(Handle, SW_SHOW);
        ShowWindow(StartHandle, SW_SHOW);
    }

    public static void Hide()
    {
        ShowWindow(Handle, SW_HIDE);
        ShowWindow(StartHandle, SW_HIDE);
    }
}
适用于Windows XP/Vista/7。

使用Flot2011回答,我可以假装我的窗口属于另一个全屏窗口。对于那些对缺失部分感到好奇的人,以下是: 我们实现了激活和停用事件的处理程序

<Window
Activated="DisplayWindow_Activated"
Deactivated="DisplayWindow_Deactivated"
/>
那么现在发生了什么?任务栏将在主应用程序中消失,因为它是全屏的。当我点击覆盖窗口时,任务栏将被激活,但被propert事件停用。因此,mashup的行为就像一个全屏应用程序

屏幕
部分用于处理多监视器设置。只有当(mashup)应用程序在主监视器上全屏显示时,我们才应该隐藏任务栏。当前解决方案假定WPF窗口和底层全屏应用程序位于同一屏幕上


如果使用
屏幕
功能,请不要忘记包含对
System.Drawing
System.Window.Forms
的引用。在这里使用不是一个好主意,因为名称空间与.net中的内容冲突。

非常感谢您的回答。我测试了一下-可能需要一天才能回来。很有趣。我认为这是一个严重的黑客,但满足了我们的需要。非常感谢。
private void DisplayWindow_Activated(object sender, EventArgs e)
{
  var screen = System.Windows.Forms.Screen.FromRectangle(
    new System.Drawing.Rectangle(
      (int)this.Left, (int)this.Top,
      (int)this.Width, (int)this.Height));
  if( screen.Primary )
    Taskbar.Hide();
}

private void DisplayWindow_Deactivated(object sender, EventArgs e)
{
  var screen = System.Windows.Forms.Screen.FromRectangle(
    new System.Drawing.Rectangle(
      (int)this.Left, (int)this.Top,
      (int)this.Width, (int)this.Height));
  if( screen.Primary )
    Taskbar.Show();
}