As far as I can see, the below function seems to be a standalone function (not a member/method of any TopWindow, or its derivative).
Therefore you are probably opening two top windows sequentially. hence the two taskbar entries.
void MyFunction()
{
PromptOK("a message"); // The first topmost window.
SomeDialog dlg;
dlg.Execute(); // The second topmost window.
}