bnobre 0 Posted June 16, 2023 Hello everybody, I'm having an unusual difficulty. My system when opening checks if it has any updates, if so it opens an updater program that downloads a new version of it, loads the system again and closes. The problem is that sometimes, for example, when opening the updater program, it hides behind other windows and the user is unaware that an update is being performed. Or when it updates and opens the system again, it hides behind other windows and the user doesn't notice that the system has already opened. How do friends deal with this situation? Thanks Share this post Link to post
Der schöne Günther 316 Posted June 16, 2023 (edited) Please elaborate on how you open your updater application (source code), because that's important. Edited June 16, 2023 by Der schöne Günther Share this post Link to post
programmerdelphi2k 237 Posted June 16, 2023 you can try send this command after your task (updating app)... // // a sample using a Timer but you can use only the commands: WindowState and SetForeGroundWindow() // procedure TForm1.FormCreate(Sender: TObject); begin Timer1.Interval := 3000; Timer1.Enabled := true; Caption := 'Timer enabled...'; end; procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := false; // Self.WindowState := TWindowState.wsNormal; // SetWindowPos(Handle, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_SHOWWINDOW); SetForeGroundWindow(Self.Handle); //BringWindowToTop(Application.Handle); Caption := 'restoring window state... all task concluded!'; end; Share this post Link to post
Lars Fosdal 1792 Posted June 19, 2023 Personally, I would be fine with it being in the background while I wait for it to complete the update/restart. At that point - I'd prefer a notification panel that would allow me to refocus the new window manually. I really do not like apps that bring themselves to the foreground - for whatever reason. I am looking at you, configured to start-with-first-login Teams, Outlook, and Discord. If I didn't initiate the starting of the app MANUALLY, I don't want it to grab my focus and keyboard input. 2 Share this post Link to post