I want to run the app in silent mode by passing in a parameter, otherwise I will show the window.
See Question&Answers more detail:osI want to run the app in silent mode by passing in a parameter, otherwise I will show the window.
See Question&Answers more detail:osShowWindow(... SW_HIDE ...)
doesn't work?
The best practice here is to not create the window in the first place. Nothing forces you to actually create a window in InitInstance. Though if you're working with MFC it's likely a lot of your application/domain/business logic is sitting there, tightly coupled to those MFC message handlers and so forth. In which case the window will need to exist.