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. Problem trying to Advise

Problem trying to Advise

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

    Hi. I'm developing a program that instantiates a COM executable. In my machine the problem doesn't occur, but in the machine of a colleague we have this problem. The source code are the same, without any modification. We are using Visual C++ 6.0 SP5, Win2K and WinXP. The code below are the code that works in one machine and in another doesn't work.

        HRESULT                       hr;
        IUnknown                    * pXXXXX;
        IConnectionPointContainer   * pCPC;
        IConnectionPoint            * pCPIXXXXXEvents;
    
        // Call COM service to create an instance.
        pXXXXX          = NULL;
        pCPIXXXXXEvents = NULL;
        pCPC               = NULL;
        m_pIXXXXXEvents = new CIXXXXXEvents(this);
        m_bComError        = TRUE;
    
        hr = CoCreateInstance(CLSID_XXXXX, NULL, CLSCTX_LOCAL_SERVER, IID_IUnknown, (LPVOID*)&pXXXXX);
        if (FAILED(hr))
        {
            pXXXXX = NULL;
            OutputDebugString("Failed to create XXXXX COM object");
        }
    
        hr = pXXXXX->QueryInterface(IID_IXXXXX, (LPVOID*)&m_pIXXXXX);
        if (FAILED(hr))
        {
            m_pIXXXXX = NULL;
            OutputDebugString("Couldn't QueryInterface for m_pIXXXXX");
        }
    
        //Asking ConnectionPointContainer.
        hr = pXXXXX->QueryInterface(IID_IConnectionPointContainer, (LPVOID*)&pCPC);
        if(FAILED(hr))
        {
            OutputDebugString("Couldn't QueryInterface for pCPC");
        }
    
        //looking for ConnectionPoint into this.
        hr = pCPC->FindConnectionPoint(__uuidof(_IXXXXXEvents), &pCPIXXXXXEvents);
        if(FAILED(hr))
        {
            OutputDebugString("Couldn't FindConnectionPoint for pCPIXXXXXEvents");
        }
    
        //Registering my interfaces.
        hr = pCPIXXXXXEvents->Advise(m_pIXXXXXEvents, &ulAdviseSFN);
        if(FAILED(hr))
        {
            // the error occurs here. The hr is equal -2147220990 and the I can't be advised from
            // the executable to my program.:((
            OutputDebugString("Couldn't Advise for m_pIXXXXXEvents");
        }
    

    Anyone has any idea of what is happening and a suggestion of how to solve it? Thanks Dennis

    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