Поделиться через


Instantiating the Process Debug Manager

To register the program with the process debug manager (PDM), create an instance of the PDM and obtain its IDebugProgramPublisher2 interface. The PDM is implemented as a multiple-use server and is typically instantiated when Visual Studio starts a program. A call to CoCreateInstance typically returns the existing PDM IDebugProgramPublisher2 interface.

To instantiate the PDM

  1. In Class View, right-click the CProgram class and click Add Variable to add a variable with the Variable name m_srpProgramPublisher, the Variable type CComPtr<IDebugProgramPublisher2>, and an Access type of protected.

  2. Open the Program.cpp file, find the CProgram::Start method, and add the following bold lines:

        m_spEngine = pEngine;
    
        HRESULT hr = m_srpProgramPublisher.CoCreateInstance(CLSID_ProgramPublisher); 
        if ( FAILED(hr) ) 
        { 
            ATLTRACE("Failed to create the program publisher: 0x%x.", hr); 
            return; 
        } 
    
  3. Build the project to make sure there are no errors.

See Also

Tasks

Registering the Program with the PDM