windows - How do I know the .exe that loaded my dll is about to exit? -
I have a DLL which is actually a com service that is registered and then loaded by another .exe process I'm going to want that when users exit the .exe to take steps to stop some resources within their DLL, before it's too late. I tried to block DLLPROCESSDETACH or DLLTHREADDETACH from DllMain of my DLL but it seems that when it goes there, it is already too late, my DLL (which I need to execute the closing steps ) Has already stopped! Of course, I do not control the .exe code, otherwise I want to call them to execute those clear completion steps before removing those calls. I can only work on DLL.
Does any one work for this situation?
Thank you very much for any input.
You can write a static object with dtor, once the service is finished After going to the dtor will be called and cruntime is about to unload.
straight cdtorMyDll {~ CDtorMyDll {// can cleaning stuff here. }}; Static CDTor Model Datherer Dyal;
Comments
Post a Comment