I have an application that is being deployed via a Visual Studio Setup Project, however, I had to create some custom Windows Forms to collect some specific data from the user. These forms are shown in the Install() method of the application’s Installer class, right after application files have been deployed by the Setup Project (I.E. the MSI). The problem is that when my forms appear, they appear under the Setup Project’s window rather than being the topmost form on the screen. The form then has to be focused on manually by clicking on its icon in the taskbar to bring it up, if the user even notices it.
Share
All I had to do was pick the Setup project’s window from the list of processes and set it as the owner of the custom forms as I was displaying them. Here’s a breakdown of the steps I used:
Myself, I made a method which returns the Setup Project’s window as a WindowWrapper, and then used that in each of the Installer class’s methods (Install, Commit, Uninstall and Rollback) to set the owner of every form and messagebox I am creating.
Also, don’t change the owners of any child forms or messageboxes of your custom forms (except maybe to “this”), as they’ll be owned by the custom forms that show them; otherwise they’ll show up over the Setup project’s window but under the custom forms, not that we desired.