admin管理员组

文章数量:1434363

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.

本文标签: