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. COM
  4. How can I add a function to COM?

How can I add a function to COM?

Scheduled Pinned Locked Moved COM
helpquestioncom
1 Posts 1 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.
  • I Offline
    I Offline
    ilavl
    wrote on last edited by
    #1

    I am a learner and I ve got a COM. I try to learn the structure of the COM, and then did three steps to add a function to the COM and its Interface: 1. In DECLARE_INTERFACE_(ITest4, IUnknown), I added a fuction like this: STDMETHOD(ChangeTest) (THIS_ int nToBeChanged ) PURE; 2. In the CTest4 declaration I added: STDMETHODIMP ChangeTest(int nToBeChanged); 3. In the CTest implement I appended : HRESULT CNvRender::ChangeTest(int nToBeChanged) { m_nChangeNo = nToBeChanged; ::MessageBox(NULL, "fasdf", "hehe",MB_OK); return 0; } 4. register it and get the interface pointer in my file: ITest4 *p; ......(get the pointer p and check it whether it is valid) p->ChangeTest(2); and here the problem arise: Access Violation What's wrong with it ? I need your help.

    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