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. Adding MFC to ATL

Adding MFC to ATL

Scheduled Pinned Locked Moved C / C++ / MFC
c++comdebugginghelpquestion
4 Posts 4 Posters 1 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi! I created an ATL project and checked "Support MFC" in the ATL COM AppWizard. Then, I added some code to create a CTreeCtrl object. I had to #include afxcmn.h to compile the project(because of the CTreeCtrl). The problem is, I'm getting debug assertion failures inside CTreeCtrl::Create because the AfxGetInstanceHandle() returns NULL. Should I be able to use CTreeCtrl(and other common controls) inside an ATL project?

    F U M 3 Replies Last reply
    0
    • L Lost User

      Hi! I created an ATL project and checked "Support MFC" in the ATL COM AppWizard. Then, I added some code to create a CTreeCtrl object. I had to #include afxcmn.h to compile the project(because of the CTreeCtrl). The problem is, I'm getting debug assertion failures inside CTreeCtrl::Create because the AfxGetInstanceHandle() returns NULL. Should I be able to use CTreeCtrl(and other common controls) inside an ATL project?

      F Offline
      F Offline
      Franky Braem
      wrote on last edited by
      #2

      You don't have to use "Support MFC" in an ATL-project when you want to use the TreeCtrl. Check my website www.braem17.yucom.be (ATL - SAWEditListCtrl). It gives you an example of how you can use common controls in ATL.

      1 Reply Last reply
      0
      • L Lost User

        Hi! I created an ATL project and checked "Support MFC" in the ATL COM AppWizard. Then, I added some code to create a CTreeCtrl object. I had to #include afxcmn.h to compile the project(because of the CTreeCtrl). The problem is, I'm getting debug assertion failures inside CTreeCtrl::Create because the AfxGetInstanceHandle() returns NULL. Should I be able to use CTreeCtrl(and other common controls) inside an ATL project?

        U Offline
        U Offline
        User 1052
        wrote on last edited by
        #3

        Although you don't need mfc to use it... when you need an instance... try _Module.m_hInst

        1 Reply Last reply
        0
        • L Lost User

          Hi! I created an ATL project and checked "Support MFC" in the ATL COM AppWizard. Then, I added some code to create a CTreeCtrl object. I had to #include afxcmn.h to compile the project(because of the CTreeCtrl). The problem is, I'm getting debug assertion failures inside CTreeCtrl::Create because the AfxGetInstanceHandle() returns NULL. Should I be able to use CTreeCtrl(and other common controls) inside an ATL project?

          M Offline
          M Offline
          Mike Dunn
          wrote on last edited by
          #4

          I bet you're doing your CTreeCtrl stuff in an exported function or COM method, right? You need to add this line at the very beginning of the function/method: AFX_MANAGE_STATE(AfxGetStaticModuleState()); This sets up some internal data structures so all the MFC code knows where to find resources and other stuff.

          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