Messenger Wont Exit

L

Leo Havmøller

If I have used the IMessenger API, Messenger wont exit (shows that pesky
"There are other applications currently using features" dialog).

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;
}


Leo Havmøller.
 
L

Leo Havmøller

hr = CoCreateInstance(CLSID_Messenger, NULL, CLSCTX_ALL, IID_IMessenger,

It seems that using CLSCTX_LOCAL_SERVER instead of CLSCTX_ALL solves the
problem.

Leo Havmøller.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top