zoukankan      html  css  js  c++  java
  • 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); } }
  • 相关阅读:
    二开下推
    二开获取yigo设计器里查询集合里中的某个SQL
    exportExcel()方法注意事项
    重启流程 杀死流程 结束流程 指定到工作项 工作项状态标志
    安装Jaspersoft Studio
    Jaspersoft Studio简介
    C语言&*符号使用及大端法小端法测试
    MyBatis别名
    Spring系列之Alias标签的解析与使用
    简单测试Java线程安全中阻塞同步与非阻塞同步性能
  • 原文地址:https://www.cnblogs.com/Mo-MaTure/p/4211908.html
Copyright © 2011-2022 走看看