views:

8

answers:

0

Another question about my add-in for visual studio. Now, I had two experiments as following:

  1. In my add-in library's main thread, I call CreateWindowEx to create a window(or CreateDialogParam to create a modeless dialog) and call CreateThread to create a thread where the window's message loop is running. Then I will have a problem I've described in Why I lost input focus in visual studio 2005/2008.
  2. In my library's main thread, I call CreateThread to create a thread and within the thread process I call CreateWindowEx to create a window and do the message loop. The input focus problem will not arise now but I will encounter another problem that I can't get Debugger object. Code is as such,

    CComPtr<EnvDTE::_DTE> pApp; // Assigned somewhere 
    //...
    EnvDTE::DebuggerPtr pDebugger;
    if (S_OK == pApp->get_Debugger(&pDebugger)) //return is not S_OK now.
    {...}
    

Why?