[RESOLVED] ATL Simple COM understanding..
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: [RESOLVED] ATL Simple COM understanding..

  1. #1
    Join Date
    Oct 2005
    Posts
    229

    [RESOLVED] ATL Simple COM understanding..

    As per normal, half an hour after finally asking for help the issue gets resolved. I had a thread exciting (unknowingly) and causing all sorts of funkyness )

    Hi All

    I have just spent the last few days, tearing my hair out, reading, then reading some more an still failing to understand... I have a few questions however this post will get far to long asking them all outright so ill ask them in manageable blocks.

    The situation so far is like this: I have an out of proc COM server, as an executable, not a service. I have added one ATL simple object.

    My understanding is the COM server will start up when i create an instance of the simple object. It will keep running as long as i have one interface to it. If i release the interface the server will be shutdown. CoCreateInstance creates the instance and also returns the interface pointer (hence internally AddRef should have been called, i.e. the server should not close until this is released?).

    Is this correct?
    Are there any special circumstances in which the server will be closed anyway?

    Currently if i create one instance and have one interface to the com object the server still closes after about 5 minutes. I cannot understand this at all.

    The COM object is marked as single threaded, and as a singleton. I am also calling ::CoInitialize(NULL); which is the same as CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

    I have thought about making the COM server internally create an instance of the COM object and holding onto its interface so that once its started it will never close (even when all the clients have released their interface pointers) however thats a step ahead of where im at currently.

    Please, any thoughts or comments would be greatly appreciated.
    Last edited by UnfitElf; February 9th, 2010 at 09:34 PM.
    Learning somthing new every day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center