My code creates many copies of itself via CreateProcessA(). These do not display anything on the monitor except for a small status dialog with a progress bar, stop button, and some icons. That dialog is supposed to stay on top of everything else until that process terminates.
When I run the code, those dialogs all show up and function normally at first. But as the processes cycle through its data, at the next cycle those windows go behind the main window showing process 0. That's no good; the user wants to monitor the progress on the other processes, so they have to be visible.
But if I run the same data over again, without restarting the program, they show up and stay on top as they should. Here's what I have tried. This is done by the other processes when they update the status dialog.
HWND h = (HWND)myMPROGRESSBAR;
SetWindowPos( h, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE );
SetForegroundWindow(h);
SetFocus(h);
myMPROGRESSBAR->SetActiveWindow();
myMPROGRESSBAR->SetFocus();
HWND h = (HWND)myMPROGRESSBAR;
ShowWindow(h, SW_MINIMIZE);
ShowWindow(h, SW_RESTORE);
Nothing seems to work better. Why would the second time work and not the first? All the calls and data are the same.