Create a dialog based MFC project. In the InitInstance you mainwindow will be shown. Disable this code and you can use it like it is a commandline program. Afterwards you can enable the disabled code and you will have a mainwindow.