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
D

djavanci

@djavanci
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem trying to Advise
    D djavanci

    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

    C / C++ / MFC c++ help question com tutorial

  • Multithread problem with DLL
    D djavanci

    About the item 1, I will analyze further the method __declspec(thread) and try to use it. But in the 2nd item, you told me to rebuild DLL using the multi-threaded libraries. In Visual C++ 6, Project->Settings, C/C++ tab with Code Generation option selected, it has an combo box called "Use run-time library". The option selected there already is "Multithreaded DLL". There's another way to configure this? How it does? Dennis

    C / C++ / MFC question c++ help

  • Multithread problem with DLL
    D djavanci

    I'm not using LoadLibrary method. I'm importing the .tlb of the DLL file and then linking to my program. To create a new instance of the DLL, im using the methods CoInitializeEx with the parameters 0 and COINIT_MULTITHREADED and then CoCreateInstance with the parameters CLSID_DLL, NULL, CLSCTX_ALL, IID_IUnknown, (LPVOID*)&pointer);

    C / C++ / MFC question c++ help

  • Multithread problem with DLL
    D djavanci

    Hi. I'm developing a program with visual C++ that creates multiple threads and each thread creates a new instance of the same DLL (which I have the the code, but I didn't developed it). The problem I'm having is that when I create the first thread, the DLL is instantiated correctly but when I create the second thread and try to create a new instance of the dll, I didn't actually create a new instance, but just makes an instance of the DLL already instantiated, and so I overwrite some variables and stuffs like that. If, instead create two threads I execute the program twice, running at the same time, I can make new instances of the DLL. Why in this way I can make a new instance of the DLL and using threads I can't? How do I know if the DLL was created as a multithreaded DLL? And another question is if the DLL wasn't created a multithreade DLL, how can I change this? Dennis

    C / C++ / MFC question c++ help
  • Login

  • Don't have an account? Register

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