I have boiled it down to the following console sample, which only calls CoCreateInstance() and Release().
AFAIK everything is released and cleaned up, but the application must be closed before messenger will exit.
What am I missing?
#include <windows.h>
#include <objbase.h>
#include <stdio.h>
#include <conio.h>
const GUID IID_IMessenger =
{0xd50c3186,0x0f89,0x48f8,{0xb2,0x04,0x36,0x04,0x62,0x9d,0xee,0x10}};
const GUID CLSID_Messenger =
{0xb69003b3,0xc55e,0x4b48,{0x83,0x6c,0xbc,0x59,0x46,0xfc,0x3b,0x28}};
int main(int argc, char* argv[])
{
HRESULT hr;
IUnknown* pMsgr;
CoInitialize(0);
hr = CoCreateInstance(CLSID_Messenger, NULL, CLSCTX_ALL, IID_IMessenger, (void**)&pMsgr);
printf("CreateInstance=%u=0x%X\n", hr, hr);
if (pMsgr)
{
pMsgr->Release();
}
CoUninitialize();
printf("Try to exit messenger now.\n");
_getch();
return 0;
}

Sign In
Register
Help

MultiQuote