In the real application (industrial automation), a thread is created to run a lengthy process. During this, another process is launched and you can see the focus is gone from the main application. After the focus is gone, later, this thread
tries to display a TopMost dialog. This dialog is hidden behind the main application even though TopMost is set.
I managed to demonstrate (sort of) this problem in a simple application. This is a standard form application with a button. When the button is clicked, a thread is spawn which starts the notepad process, waits for 5s, then shows a TopMost
private void button1_Click(object sender, EventArgs e)
Thread thread = new Thread(ThreadProc);
ProcessStartInfo pi = new ProcessStartInfo("notepad.exe");
Process p = Process.Start(pi);
// Show a dlg from a worker thread.
Form form = new Form();
form.TopMost = true;
View Complete Post