Monday, March 15, 2010

Cannot disable menu item in MFC

If you encounter a problem where a menu item always appear as enabled, even if you disable it in the resource editor, then this is caused by the 'auto enable menu item' behavior of mfc. One way around this is simple to set the member variable responsible for this in your frame to false, which can be done in the OnCreate method for example.

m_bAutoMenuEnable = 0;



Tuesday, March 2, 2010

Problem when drawing directly on the Device Context in Windows 7

On some computers running windows 7, if you draw using DC.LineTo(x,y) directly on the screen device context, your drawing might not show. Possible solutions are:

- The quickest workaround we have found yet is to draw a small circle also, because for some reason drawing a circle forces a screen repaint, so a simple extra line like DC.Ellipse(x,y,x+1,y+1) can solve the problem

- If you switch the windows theme to Windows Classic, everything will work fine.

Strange bug!