最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Preventing Windows Taskbar and Messages from Appearing Over a Fullscreen Delphi FMX Application Running Indefinitely - Stack Ove

programmeradmin0浏览0评论

I have developed a Delphi 10.2. FMX application that runs in fullscreen mode on Windows 10 and 11, displaying animated graphics continuously for extended periods (several months). To maintain an uninterrupted display, I've disabled all Windows messages and notifications. Nevertheless, it has already occurred that the Windows taskbar or other Windows messages appear over the application, disrupting the fullscreen experience.

To address this, I tried to implemented a TTimer that triggers every 10 seconds, attempting to bring the application back to the foreground and reassert its fullscreen state.

procedure TForm1.Timer1Timer(Sender: TObject);
var
  NativeHandle: HWND;
begin
  // Retrieve the native window handle
  NativeHandle := WindowHandleToPlatform(Self.Handle).Wnd;

  // Bring the form to the front
  SetForegroundWindow(NativeHandle);
end;

This works fine when I start the application in debugging mode from within the IDE. It does not work when I run the application directly outside the IDE by double clicking on the EXE file. In this case nothing happens when the timer event fires.

What could be the problem?

Or is my whole approach going in the wrong direction?

I have developed a Delphi 10.2. FMX application that runs in fullscreen mode on Windows 10 and 11, displaying animated graphics continuously for extended periods (several months). To maintain an uninterrupted display, I've disabled all Windows messages and notifications. Nevertheless, it has already occurred that the Windows taskbar or other Windows messages appear over the application, disrupting the fullscreen experience.

To address this, I tried to implemented a TTimer that triggers every 10 seconds, attempting to bring the application back to the foreground and reassert its fullscreen state.

procedure TForm1.Timer1Timer(Sender: TObject);
var
  NativeHandle: HWND;
begin
  // Retrieve the native window handle
  NativeHandle := WindowHandleToPlatform(Self.Handle).Wnd;

  // Bring the form to the front
  SetForegroundWindow(NativeHandle);
end;

This works fine when I start the application in debugging mode from within the IDE. It does not work when I run the application directly outside the IDE by double clicking on the EXE file. In this case nothing happens when the timer event fires.

What could be the problem?

Or is my whole approach going in the wrong direction?

Share Improve this question asked Nov 17, 2024 at 15:05 user3384674user3384674 8371 gold badge9 silver badges32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -2

In a clean Desktop start your program. Start the Task Manager and under Details select each explorer out of two and End Task. That will leave your program and Task Manager showing. Use Start New Task and add "explorer" in run dialog's edit box to get back to "Windows".

However, above only helps hiding the taskbar. On my Win 11 machine running Delphi 12.2 building and running a FMX program works until closing Delphi even with detach. This is fixed by not running Delphi in above Desktop. That is run the exe without Delphi running.

An industrial application may load only the program* and require a login to access the task manager and file explorer.

  • You would change windows registry to start your program and not explorer.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论