ATL and MFC simple data types
-
Is there any way to use some of the simple MFC data types and collections like CString, CTime, CUIntArray, etc. inside ATL methods? The compiler keeps barking at me when I include afx.h: #error WINDOWS.H already included. MFC apps must not #include I've tried few things without luck. I'm pretty much resigned to writing a class to isolate ATL from the MFC stuff. I have some old code that uses these things pretty heavily and I would like to incorporate this code without a major rewrite.
-
Is there any way to use some of the simple MFC data types and collections like CString, CTime, CUIntArray, etc. inside ATL methods? The compiler keeps barking at me when I include afx.h: #error WINDOWS.H already included. MFC apps must not #include I've tried few things without luck. I'm pretty much resigned to writing a class to isolate ATL from the MFC stuff. I have some old code that uses these things pretty heavily and I would like to incorporate this code without a major rewrite.
If you have an ATL dll project you only need to check "Support MFC" in the first page of the wizard. If you are building a ATL exe project a little more work is involved. This info can be found in KB article Q173974 located at: http://support.microsoft.com/support/kb/articles/Q173/9/74.ASP?LN=EN-US&SD=msdn&FR=0 You should also consider linking to MFC statically if you are only using simple data types.
-
Is there any way to use some of the simple MFC data types and collections like CString, CTime, CUIntArray, etc. inside ATL methods? The compiler keeps barking at me when I include afx.h: #error WINDOWS.H already included. MFC apps must not #include I've tried few things without luck. I'm pretty much resigned to writing a class to isolate ATL from the MFC stuff. I have some old code that uses these things pretty heavily and I would like to incorporate this code without a major rewrite.
Hi, I think the best thing to do is to use Windows Template Library instead of MFC classes. WTL is a set of classes that extend ATL to support more complex user interfaces for either applications or various UI components, while maintaining the big advantage of ATL - small and fast code. It doesn't have all the data types you need but it has CString, CRect, CPoint, CSize and lot's of other useful things. So if the size of the code and performance are important to you - go with WTL. WTL is a part of Platform SDK and you can download it from http://www.microsoft.com/msdownload/platformsdk/setuplauncher.htm. Regards, Alex Gorev, Dundas Software.