-1

I'm developing a Delphi application that is a small utility window. The idea is that it stays always on top of all other windows providing information to the user and allowing him to press a button. I don't want to show the app's icon in the taskbar since it's a small utility that shouldn't be in the way of the user and I also want the user to be able to put it over the taskbar if he so desires.

I've already got it to not show the taskbar icon using the following from this question:

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle and not WS_EX_APPWINDOW;
  Params.WndParent := Application.Handle;
end;

And I've also found this other question which is concerned with the form being above the taskbar in a full screen application:

procedure TForm1.CreateParams(var Params: TCreateParams); 
begin
  inherited; 
  Params.Style := WS_POPUP or WS_VISIBLE; //will overlay taskbar
end;

What I haven't been able to do is marry the two.

1 Answers1

0

There is no way for a third-party application's window to always be "the most topmost" window above Windows components. By Windows components I'm refering to the taskbar and the Task Manager (with the Always on top option ticked off), for example.

As explained here, here and here, there is no documented API for setting a window as the most topmost window in the Z order and Windows components that do that seem to use a special private API to do so.

One (albeit not very elegant) way to prevent the app window from being hidden behind the taskbar is setting a timer that brings it to the top using SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NoMove or SWP_NoSize); or SetForegroundWindow.