Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ATL and MFC simple data types

ATL and MFC simple data types

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10358097
    wrote on last edited by
    #1

    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.

    T A 2 Replies Last reply
    0
    • U User 10358097

      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.

      T Offline
      T Offline
      TBK
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • U User 10358097

        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.

        A Offline
        A Offline
        Alex Gorev
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups