K
K
kalapanga2016-10-17 10:27:09
Delphi
kalapanga, 2016-10-17 10:27:09

Why is the form not displayed on top of all windows under Windows 10?

There is a program on Delphi XE8, hanging in the notification area and showing a window with information on certain events. Under Windows 7, the following code showed the form on top of all windows almost 100%.

with TfrmInfo.Create(self) do
begin
  Show;
  Application.NormalizeTopMosts;
  SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
    SWP_NOACTIVATE + SWP_NOMOVE + SWP_NOSIZE);
end;

And this code stopped working under Windows 10. More precisely, sometimes the window appears on top of all, but much more often it appears on the contrary at the very "bottom", under all windows. Can anyone come across this? And how to try to treat it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kalapanga, 2016-10-22
@kalapanga

The "culprit" was the line with Application.NormalizeTopMosts. At one time, without much thought, I inserted it into the code for some example. And under the seven, at least she did not interfere. But under ten I got a problem. I just removed that line and it worked!

Z
Zakharov Alexander, 2016-10-17
@AlexZaharow

I won’t tell you about delphi, but there is a solution for C #:
stackoverflow.com/questions/10740346/setforeground...
I use it, it works already at 99.9999% (during development it still glitched, but for several months now it has been working at 100%). I mainly work on 8.1, but there were no glitches with this method on home windows 10.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question