I have these little cursor shaped forms that I need to be on Top of everything, all the time…
FormStyle is already fsStayOnTop
I use this code:
SetWindowPos(tempCursor.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE );
and this (even though I don’t exactly know what it does):
procedure TCursorFrm.CreateParams(var Params: TCreateParams);
const
WS_EX_NOACTIVATE = $8000000;
begin
inherited;
Params.ExStyle := Params.ExStyle + WS_EX_NOACTIVATE;
end;
but I still cannot get my forms to be on Top of TMenuItems.
How can I make my forms stay on top of everything?
This has to be the ultimate, or worst, piece of hackery I’ll publish.
In the OnTimer event place the following code:
if visible then
SetWindowPos(Self.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE);
I’m using this in one of my projects and it seems to work alright.