using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace LSKWDL
{
public class CScreenLG
{
const uint SHFS_SHOWTASKBAR = 0x0001;
const uint SHFS_HIDETASKBAR = 0x0002;
const uint SHFS_SHOWSIPBUTTON = 0x0004;
const uint SHFS_HIDESIPBUTTON = 0x0008;
const uint SHFS_SHOWSTARTICON = 0x0010;
const uint SHFS_HIDESTARTICON = 0x0020;
const int SW_HIDE = 0;
const int SW_SHOWNORMAL = 1;
const int SW_SHOWMINIMIZED = 2;
const int SW_SHOWMAXIMIZED = 3;
const int SW_SHOWNOACTIVATE = 4;
const int SW_RESTORE = 9;
const int SW_SHOWDEFAULT = 10;
[DllImport("aygshell.dll")]
private static extern uint SHFullScreen(IntPtr hwndRequester, uint dwState);
[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();
[DllImport("CoreDll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("CoreDll")]
private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
/// <summary>
/// 使程序全屏显示
/// </summary>
/// <param name="objForm"></param>
public static void ShowFullScreen(System.Windows.Forms.Form objForm)
{
objForm.Capture = true;
HideHHTaskBar();
IntPtr hwnd = GetCapture();
objForm.Capture = false;
SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON);//全屏化窗口
}
/// <summary>
/// 显示任务栏
/// </summary>
public static void ShowHHTaskBar()
{
IntPtr lpClassName = FindWindow("HHTaskBar", null);
ShowWindow(lpClassName, SW_SHOWNORMAL); //显示任务栏
}
/// <summary>
/// 隐藏任务栏
/// </summary>
public static void HideHHTaskBar()
{
IntPtr lpClassName = FindWindow("HHTaskBar", null);
ShowWindow(lpClassName, SW_HIDE); //隐藏任务栏
}
}
}
wince 隐藏任务栏
最新推荐文章于 2020-04-13 07:18:19 发布