CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: ATL COM Question

  1. #1
    Join Date
    Oct 2003
    Location
    Minnesota
    Posts
    175

    ATL COM Question

    How do I keep my programming running once it has started? I have my "WinMain" which was automatically implemented for me, but I "overrode" the Run function so that I could add another call within it.

    Code:
    class CTestModule
    {
    public:
    // Override CAtlExeModuleT members
    	HRESULT Run(int nShowCmd = SW_HIDE)
    	{
    		DoSomething();
    
    		__super::Run(nShowCmd);
    	}
    };
    My program runs when called, but then disappears once the calling program leaves. I need my program to stay running so that it maintains state in-between new applications making calls to it.

    I tried to put a "while (true)" loop around Run, but that doesn't seem like the correct way to keep it running.

    Thanks in advance! Any help is greatly appreciated.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,607

    Re: ATL COM Question

    Man, just stop mutilate your server. COM server life time is unexceptionally governed by reference counting mechanism.

    _Module::Lock() is all you need.
    Last edited by Igor Vartanov; March 27th, 2007 at 03:31 PM.
    Best regards,
    Igor

  3. #3
    Join Date
    Oct 2003
    Location
    Minnesota
    Posts
    175

    Re: ATL COM Question

    Thanks - I added this to my code and it seems to have resolved my issue.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)