MFC form view projects – start maximised.

This bug is still in VS2012 just as it was in VS2008.

Create an MFC application, single document, using CFormView and tick the box that should configure your app to start maximised.

You can use this as a basis for a random number generator – it may start physically maximised, it may not, though it always _thinks_ its maximised.

To overcome this bug you must NOT tick that start-maximised check box when creating the project. Instead, you need to override the main frame’s ActivateView and replace

CFrameWnd::ActivateFrame(nCmdShow);

with

CFrameWnd::ActivateFrame(SW_MAXIMIZE);

Simples !

——–

To override ActivateView :

If using ye olde Visual-C 6, just use class wizard. So easy. Otherwise:

Open the header file, position the cursor exactly in the class name itself (CMainFrame), then either:

(<VS2012) Click on the little box on the RHS of the header on the properties panel and scroll down to ActivateFrame which would be great if you could just double-click it instead of fiddle with stupid combo box drop down.

(VS2012) Stare at the properties panel, wonder why its blank, swear profusely, swear some more, wait 30 seconds for whatever background process is running to do its job, a-ha!, properties suddenly appear, now click on the little box on the RHS of the header on the properties panel and scroll down to ActivateFrame which would be great if you could just double-click it instead of fiddle with stupid combo box drop down.

 

 

Leave a Reply