I have an application written in .NET. There was no problem in the previous version: you double-click on the icon or launch it from the command line, and when it starts, this is the main window and has focus, as you would expect.
The latest version displays a splash screen in front of the main window, and now the splash screen appears in the foreground, but the main thing does not always end in the main window. Sometimes this happens, sometimes it is not. (When launched from the command line, it invariably does not work). When the main window does not come to the fore and focus, the taskbar icon appears as orange.
I see a lot of hits on the network about how MS added a tool to prevent the focus of applications from being stolen from others, in the center of which is the ForegroundLockTimeout registry setting and related settings, but the above-described behaviors for different versions occur on the same computer.
I tried calling Activate in the main form when it was finally created, as well as SetForegroundWindow, all to no avail.
Any help is appreciated.
source
share