Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.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
以编程方式在c#中隐藏Windows 8.1的平铺_C#_Windows 8.1_Tiles_Remote Desktop_Terminal Services - Fatal编程技术网

以编程方式在c#中隐藏Windows 8.1的平铺

以编程方式在c#中隐藏Windows 8.1的平铺,c#,windows-8.1,tiles,remote-desktop,terminal-services,C#,Windows 8.1,Tiles,Remote Desktop,Terminal Services,为了使用windows 8.1,我必须扩展终端服务器软件。 该场景如下所示: 两台电脑:一台运行客户端软件,另一台运行服务器。 服务器的操作系统是Windows 8.1 当用户按下客户端PC上的按钮时,它会通过虚拟通道打开到服务器PC的RDP连接。 必须有一个登录和瓷砖必须被隐藏,而且服务器部分的软件必须是startet 为了在早期版本的windows下隐藏普通桌面,我们使用了以下命令: // For Windows Vista and Windows 7 hide the Status-Bar

为了使用windows 8.1,我必须扩展终端服务器软件。 该场景如下所示:

两台电脑:一台运行客户端软件,另一台运行服务器。 服务器的操作系统是Windows 8.1

当用户按下客户端PC上的按钮时,它会通过虚拟通道打开到服务器PC的RDP连接。 必须有一个登录和瓷砖必须被隐藏,而且服务器部分的软件必须是startet

为了在早期版本的windows下隐藏普通桌面,我们使用了以下命令:

// For Windows Vista and Windows 7 hide the Status-Bar and all Desktop-Icons
int   a_hWndTaskBar      = FindWindow( "Shell_TrayWnd", null );
int   a_hWndStart        = FindWindow( "Button", "Start" );
int   a_hWndDesktop      = FindWindow( "Progman", null );
bool  a_bResult          = false;

try
{
  a_bResult = SetWindowPos( a_hWndTaskBar, 0, 0, 0, 0, 0, SWP_HIDEWINDOW );
  a_bResult = SetWindowPos( a_hWndStart, 0, 0, 0, 0, 0, SWP_HIDEWINDOW );
  a_bResult = ShowWindow( a_hWndDesktop, SW_HIDE );
}
catch( Exception e )
{
  MessageBox.Show( e.Message );
}
要在windows 8.1中实现这一点,我必须做些什么

问候 马库斯这里:为我工作:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Constants.UI
{

    public class Taskbar
    {
        [DllImport("user32.dll")]// For Windows Mobile, replace user32.dll with coredll.dll
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle);

        [DllImport("user32.dll")]
        private static extern int ShowWindow(int hwnd, int command);

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

        protected static int Handle
        {
            get
            {
                return HandlePtr.ToInt32();
            }
        }
        protected static IntPtr HandlePtr
        {
            get
            {
                return FindWindow("Shell_TrayWnd", "");
            }
        }
        protected static int StartHandle
        {
            get
            {
                int hStart = FindWindow("Button", "Start").ToInt32();
                if (hStart == 0)
                {
                    hStart = FindWindowEx(HandlePtr, IntPtr.Zero, "Start", null).ToInt32(); //windows 8
                }
                return hStart;
            }
        }

        private Taskbar()
        {
            // hide ctor
        }
        static object lockAccess = new object();
        public static void Show()
        {
            try
            {
                lock (lockAccess)
                {
                    ShowWindow(Handle, SW_SHOW);
                    ShowWindow(StartHandle, SW_SHOW);
                }
            }
            catch { }
        }

        public static void Hide()
        {
            try
            {
                lock (lockAccess)
                {
                    ShowWindow(Handle, SW_HIDE);
                    ShowWindow(StartHandle, SW_HIDE);
                }
            }
            catch { }
        }
}