Original VS2008/VS2005 Source in stdafx.h compiles just fine but will not compile on VS2010 with same error.
error C2504: 'CAtlServiceModuleT' : base class undefined
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#undef _AFX
#undef _ATL_NO_SERVICE
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
Updated VS2010 Source in stdafx.h compiles just fine. Trick is to swap AFX and ATL order and add #undef _WINDOWS_ before including the MFC headers did the trick for me.
#undef _ATL_NO_SERVICE
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#undef _WINDOWS_
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#undef _AFX