如何从Taskbar(XE4)隐藏firemonkey应用程序按钮? [英] How to hide firemonkey application button from Taskbar (XE4)?

查看:443
本文介绍了如何从Taskbar(XE4)隐藏firemonkey应用程序按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此问题,可以通过更改窗口隐藏fmx任务栏图标风格为 WS_EX_TOOLWINDOW
在XE2和XE3中,此代码适用于:

According to this question it is possible to hide fmx taskbar icon by changing window style to WS_EX_TOOLWINDOW. In XE2 and XE3 this code works:

uses FMX.Platform.Win, Winapi.Windows;

procedure TForm1.Button1Click(Sender: TObject);
var h:THandle;
begin
  h := FmxHandleToHWND(Handle);
  ShowWindow(h, SW_HIDE);
  SetWindowLong(h, GWL_EXSTYLE, GetWindowLong(h, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
  ShowWindow(h, SW_SHOW);
end;

在XE4中,此解决方案无效(应用程序按钮应该隐藏,但没有发生)。任何身体都有任何想法?

In XE4 this solution does not work (application button should become hidden but nothing happens). any body have any idea?

谢谢。

推荐答案

HWND hWnd = NULL;
DWORD pid, current_pid = GetCurrentProcessId();
do 
{
    hWnd = FindWindowExA(NULL, hWnd, "TFMAppClass", NULL);
    if(hWnd)
    {
        GetWindowThreadProcessId(hWnd, &pid);
        if(current_pid == pid)
            break;
    }
} while(hWnd);

::SetParent(FmxHandleToHWND(Handle), NULL);
::ShowWindow(hWnd, SW_HIDE);

这篇关于如何从Taskbar(XE4)隐藏firemonkey应用程序按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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