首页 > 代码库 > wince隐藏任务栏
wince隐藏任务栏
前段时间做了一个wince项目。因为wince设备屏幕一般都比较小,所以经常隐藏任务栏来增大界面空间。在ce程序中调用下面的代码可以控制系统中任务栏的隐藏和显示
下面是代码:
/// <summary>/// 调用winceAPI/// </summary>public abstract class CommonApi{ [DllImport("coredll.dll", EntryPoint = "FindWindow")] public static extern int FindWindow(string lpWindowName, string lpClassName); [DllImport("coredll.dll", EntryPoint = "ShowWindow")] public static extern bool ShowWindow(int hWnd, int nCmdShow); [DllImport("coredll.dll", EntryPoint = "SystemParametersInfo")] public static extern int SystemParametersInfo( int uAction, int uParam, ref Rectangle lpvParam, int fuWinIni ); public const int SPI_SETWORKAREA = 47; public const int SPI_GETWORKAREA = 48; public const int SPIF_UPDATEINIFILE = 0x0001; public const int SPIF_SENDCHANGE = 0x0002; public const int SW_HIDE = 0; public const int SW_SHOWNORMAL = 1; public const int SW_SHOW = 5; public const int SW_SHOWNA = 8;}
/// <summary>/// 隐藏开始方法/// </summary>private static Rectangle winRectangle = new Rectangle();public static bool SetFullScreen(bool fullscreen){ int Hwnd = 0; Hwnd = CommonApi.FindWindow("HHTaskBar", null); if (Hwnd == 0) return false; if (fullscreen) { CommonApi.ShowWindow(Hwnd, CommonApi.SW_HIDE); Rectangle rectFull = Screen.PrimaryScreen.Bounds; CommonApi.SystemParametersInfo(CommonApi.SPI_GETWORKAREA, 0, ref winRectangle, CommonApi.SPIF_UPDATEINIFILE);//get CommonApi.SystemParametersInfo(CommonApi.SPI_SETWORKAREA, 0, ref rectFull, CommonApi.SPIF_UPDATEINIFILE);//set } else { CommonApi.ShowWindow(Hwnd, CommonApi.SW_SHOW); CommonApi.SystemParametersInfo(CommonApi.SPI_SETWORKAREA, 0, ref winRectangle, CommonApi.SPIF_UPDATEINIFILE); } return true;}
调用方法
/// <summary>/// 应用程序的主入口点。/// </summary>[MTAThread]static void Main(){
try {
//隐藏开始 SetFullScreen(true);
//显示开始 SetFullScreen(false); } catch (Exception ex) { Common.SetFullScreen(false); }}
wince隐藏任务栏
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。