If you use DoModal instead of ShowWindow it will insure your dialog will stay on top of your main window.