How to hide firemonkey application button from Taskbar (XE4)?

后端 未结 4 866
天命终不由人
天命终不由人 2020-12-18 11:13

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:

<         


        
4条回答
  •  感动是毒
    2020-12-18 11:49

    procedure HideAppOnTaskbar;
    var
      appHandle: HWND;
      pid, current_pid: DWORD;
      name: String;
    
    begin
      //ShowWindow(FindWindowA('TFMAppClass', nil), SW_HIDE);
    
      name := ChangeFileExt(ExtractFileName(ParamStr(0)), '');
    
      appHandle := 0;
      pid := 0;
      current_pid := GetCurrentProcessId();
      repeat
      begin
        //appHandle := FindWindowExA(0, appHandle, 'TFMAppClass', nil);
        appHandle := FindWindowExA(0, appHandle, 'TFMAppClass', PAnsiChar(AnsiString(name)));
        if (appHandle>0) then
        begin
          GetWindowThreadProcessId(appHandle, pid);
          if (current_pid = pid) then break;
        end;
      end
      until (appHandle>0);
    
      //SetParent(FmxHandleToHWND(Handle), nil);
      ShowWindow(appHandle, SW_HIDE);
    
    end;
    

提交回复
热议问题