如何隐藏AutoHideTaskbar选项进行选择时,任务栏和脚本(AHK脚本)试图隐藏任务栏呢? [英] How to hide a taskbar when AutoHideTaskbar option selected and a script (ahk script) trying to hide taskbar too?

查看:274
本文介绍了如何隐藏AutoHideTaskbar选项进行选择时,任务栏和脚本(AHK脚本)试图隐藏任务栏呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序设计为全屏启动,不惜一切代价,用户看不到任务栏.对于隐藏在ahk下面的任务栏,脚本将在后台运行以执行所需的操作.

My application is designed to launch in full screen, at any cost taskbar should not be visible to the user. For taskbar hiding below ahk scripts will be running in the background to perform the needed operations.

关于AHK脚本,请选择以下链接进行描述.

Regarding AHK scripting please select the below link for its description.

http://ahkscript.org/

如果选择了Windows 7的自动隐藏任务栏"功能,则该脚本不起作用.

The script doesn`t work if "Auto Hide taskbar" functionality of windows 7 is selected.

因此,我采用了以下C#代码来从应用程序一侧解决问题.

Hence I have taken the below C# code to solve the issue from the application side.

但是在某些情况下,例如在Windows重新启动后首次启动应用程序时,尤其是在选择自动隐藏"任务栏选项时,showwindow功能无法正常工作.

But in certain conditions like when the application launches for the first time after windows restart, showwindow function is not working properly especially when Auto Hide taskbar option selected.

示例代码

    [DllImport("user32.dll")]
    public static extern int FindWindowEx(int parentHandle, int childAfter, string className, int windowTitle);

    [DllImport("user32.dll")]
    private static extern int GetDesktopWindow();

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

    protected static int Handle
    {
        get
        {
            return (int)FindWindow("Shell_TrayWnd", "");
        }
    }

    protected static int HandleOfStartButton
    {
        get
        {
            int handleOfDesktop = GetDesktopWindow();
            int handleOfStartButton = FindWindowEx(handleOfDesktop, 0, "button", 0);
            return handleOfStartButton;
        }
    }
    public static void HideTaskbar()
    {
        int Taskbar = ShowWindow(Handle, SW_HIDE);
        int StartButton = ShowWindow(HandleOfStartButton, SW_HIDE);

    }

    private void button1_Click(object sender, EventArgs e)
    {
        HideTaskbar();
    }

脚本 下面的脚本隐藏了任务栏并禁用了某些键的执行.(右窗口和左窗口按钮以及 ctrl + esc )

Script Below script hides the taskbar and disables the execution of some keys.(right window and left window button and ctrl+esc)

WinHide,ahk_class Shell_TrayWnd
LWin::Suspend
RWin::Suspend
^Esc::Suspend

我尝试过的其他选项

[DllImport("user32.dll")]
    public static extern bool SetWindowPos(
    int hWnd,                 //   handle to window    
    int hWndInsertAfter,  //   placement-order handle    
    short X,                  //   horizontal position    
    short Y,                  //   vertical position    
    short cx,                 //   width    
    short cy,                //    height    
    uint uFlags             //    window-positioning options    
    );

    private void button1_Click(object sender, EventArgs e)
    {

        int hwnd = FindWindow("Shell_TrayWnd", "");
        SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
    }

以上代码会更改功能.无法正常工作.

Above code alters the functionality. Not working properly.

请提出任何解决此情况的方法.

Please suggest any ways to handle this scenario.

推荐答案

人们仍然可以通过按键盘上的Windows键或其他快捷方式来访问任务栏.您要做的就是破解计算机的注册表项,以破坏用户的自定义快捷方式.

People will still be able to access the taskbar by pressing the Windows key on the keyboard or some other shortcut. All you're doing is hacking the computer's registry keys to mess with the user's customized shortcuts.

您真正想做的是创建一个全屏最大化窗口(类似于最大化youtube视频时看到的窗口).

What you really want to do is create a fullscreen maximized window (similar to what you see when you maximize a youtube video).

设置窗口的属性,以便: 1. FormBorderStyle =无, 2.在加载表单时,获取屏幕矩形,然后将窗口调整为该大小.

Set the properties of your window such that: 1. FormBorderStyle = None, 2. On form load, get screen rects and resize your window to be of that size.

这篇关于如何隐藏AutoHideTaskbar选项进行选择时,任务栏和脚本(AHK脚本)试图隐藏任务栏呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆