Re: How to keep my com exe alive?



Hi Igor,
Thanks for this.
Overriding PostMessageLoop works when the Module.Lock() is not used. If
I use the Lock() and does not call Unlock() anywhere, the exe will go
down only when the system shuts down, right?
Now, what I am looking for is a way to trap the WM_QUIT that is sent to
my exe when the system shuts down and save my internal data at that
time.
Is that possible? If yes, how can I do it?
Thanks,
Shaji.

Igor Tandetnik wrote:
"shaji" <shajiparemmal@xxxxxxxxx> wrote in message
news:1141820689.598628.253300@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
1. I want to keep my com exe (just one ATL COM object - free threaded
- dual interface) running even after all the clients have quit. But I
don't want to make it a service.

Call _Module.Lock() to keep yourself alive. Call Unlock() when you
finally decide it's time to terminate.

2. When the exe shuts down, I want to save some internal data (in
fact, an stl list) onto the disk so that it can be read when next
time the exe starts up

Override PostMessageLoop in your CAtlExeModule-derived class.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925

.



Relevant Pages

  • Re: How to keep my com exe alive?
    ... You have to decide how does your executable terminate - ... Overriding PostMessageLoop works when the Module.Lockis not used. ... I use the Lockand does not call Unlock() anywhere, the exe will go ...
    (microsoft.public.vc.atl)
  • Re: How to keep my com exe alive?
    ... terminated only at the time of shutdown or user log off (the forceful ... Will I be able to take any action when the exe is forcefully ... I use the Lockand does not call Unlock() anywhere, ... finally decide it's time to terminate. ...
    (microsoft.public.vc.atl)
  • Re: How to keep my com exe alive?
    ... If I use the Lock() and does not call Unlock() anywhere, the exe will ... it won't peacefully terminate on its own. ...
    (microsoft.public.vc.atl)
  • Re: This works, but I dont know why :)
    ... there are overlays still on disk the exe needs ... My Clipper exes, all overlaid, are always open ... Have an active lock? ... operation the first step in execution. ...
    (comp.lang.clipper)
  • Re: Cant delete VB.NET directories & files...
    ... For some reason something's got a lock on them. ... If you try to delete the exe it will fail. ... any of the VB.NET directory structures that contain my test projects ...
    (microsoft.public.dotnet.languages.vb)

Loading