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. ActiveX and Windows C++

ActiveX and Windows C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelpquestion
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.
  • A Offline
    A Offline
    ashok123
    wrote on last edited by
    #1

    Hello, I am working on a project and I am stuck at one place. I have 2 applications. 1-> ActiveX Control (Developed in MFC) 2-> A Windows C++ application.(No MFC...purely Windows) How can I use the functions defined in ActiveX into this C++ application. I tried adding the ActiveX header file in my C++ application but then I get an error of CWnd, CString etc classes of MFC not found. Please let me know if you or any of your friends know the solution. Please email me at dubeyashok@yahoo.com Thanks in Advance. Ashok Dubey Ashok

    C C 2 Replies Last reply
    0
    • A ashok123

      Hello, I am working on a project and I am stuck at one place. I have 2 applications. 1-> ActiveX Control (Developed in MFC) 2-> A Windows C++ application.(No MFC...purely Windows) How can I use the functions defined in ActiveX into this C++ application. I tried adding the ActiveX header file in my C++ application but then I get an error of CWnd, CString etc classes of MFC not found. Please let me know if you or any of your friends know the solution. Please email me at dubeyashok@yahoo.com Thanks in Advance. Ashok Dubey Ashok

      C Offline
      C Offline
      charlieg
      wrote on last edited by
      #2

      Ashok, I'm no expert yet on mfc, but from what I've seen, mfc is nothing more than a bunch of wrapper code around the win32 functions. So, I don't think there is any reason why you cannot do this. I would suggest creating a dummy mcf application with ActiveX support. Take a look at the stdafx header file. Also, there your Windows app must call AfxEnableControlContainer(); You'll see all of this in your dummy application. You should get pretty far with this approach. chg C. Gilley Will program for food... Whoever said children were cheaper by the dozen... lied.

      1 Reply Last reply
      0
      • A ashok123

        Hello, I am working on a project and I am stuck at one place. I have 2 applications. 1-> ActiveX Control (Developed in MFC) 2-> A Windows C++ application.(No MFC...purely Windows) How can I use the functions defined in ActiveX into this C++ application. I tried adding the ActiveX header file in my C++ application but then I get an error of CWnd, CString etc classes of MFC not found. Please let me know if you or any of your friends know the solution. Please email me at dubeyashok@yahoo.com Thanks in Advance. Ashok Dubey Ashok

        C Offline
        C Offline
        Calc20
        wrote on last edited by
        #3

        Hi. You can access its methods as you would access any other COM object's methods. Use CoCreateInstance to create the object (based on its CLSID)and that will give you a pointer to the object's IDispatch interface. Ex: IDispatch* pDisp; CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &pDisp); clsid is the Class ID for the ActiveX object and iid is the Interface ID for the IDispatch interface of the object. After that you can use pDisp->GetIDsOfNames() to get dispatch ids based on method names, and with that dispatch id you can use pDisp->Invoke() to call the method. Remember to call pDisp->Release() to decrement the reference counter for that interface so the object can be destroyed.

        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