How to disable autoclosing of a dialog-based MFC application in Visual Studio?

When I start the program, I get the dialog and everything. But it closes by itself after some 10 seconds. How do I disable that?

EDIT: This happens when I run “Debug → Start Without Debugging”. This is the only way I know how to run the program.

EDIT2: My dialog is inheriting from

CDialogEx

.