If you get REGDB_E_CLASSNOTREG, maybe you are mixing 32-bit and 64-bit things: maybe you are trying to call CoCreateInstance from a 64-bit program if you don't have a 64-bit version of VS2010 (do they have one?)
I also found this , which was an instance of someone passing a pointer to void, not a pointer to a pointer to void. You did not specify what type of _PDM is, so I cannot say if you declared it correctly (although you should have received a compiler warning if that were the case.)
Edited to add:
#pragma comment(lib, "ole32.lib") #define UNICODE #define STRICT #include <windows.h> #include <activdbg.h> #include <iostream> using std::wcout; using std::hex; using std::endl; int main(void) { HRESULT hr; IProcessDebugManager *ppdm = NULL; IDebugApplication *pda = NULL; IClassFactory *pcf = NULL; DWORD cook = 0; CoInitialize(NULL); hr = CoGetClassObject(CLSID_ProcessDebugManager, CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory, (LPVOID *)&pcf); wcout << L"CoGetClassObject: " << std::hex << hr << endl; if (FAILED(hr)) goto done; hr = pcf->CreateInstance(0, IID_IProcessDebugManager32, (LPVOID *)&ppdm); wcout << L"CreateInstance: " << std::hex << hr << endl; if (FAILED(hr)) goto done; pcf->Release(); hr = ppdm->CreateApplication(&pda); wcout << L"CreateApplication: " << std::hex << hr << endl; if (FAILED(hr)) goto done; ppdm->AddApplication(pda, &cook); pda->SetName(L"Moosh!"); ppdm->RemoveApplication(cook); pda->Release(); ppdm->Release(); done: CoUninitialize(); return 0; }
There is no real error checking, it does nothing but checking one basic function, etc., but it does not cause any errors. You did not provide any details as to what “does not work” means, and as I said, I don’t know how to use this material, but I can at least get IProcesDebugManager and IDebugApplication with this code.
source share