I have a bit of a "Catch-22" that an EXE calls a DLL that in the DLL is a tight loop and even though I am using a Global variable as a Flag to escape, the flag is not set until the function ends. (Yes I know do not get me started on globals
)
Anyways, from Messageboxes I have determined that LibMain does not fire the %DLL_PROCESS_DETACH until after I have physically clicked a button to set the flag, so I can not programmatically set the flag, nor simulate a click to set the flag.
I thought about checking IsWindow, and pass the handle to the parent exe into the functions, but that does me no good if there is no parent window or the parent is the desktop.
I even thought about the hInstance, but since a dll is mapped into the parent instance, that does me no good either.
Is there some windows api that I can use to determine if the "Parent" is closing, so I can cleanly stop any routines that are not seeing the flag set? If it weren't for the idea that all the functions are in the same thread, I would look deeper at MCM's Waitable objects and being cancelled, but the size of the project is too huge to re-write from scratch, and a new project (I hope to make better since I can start it from scratch) takes priority.
Anyways anyone with a temporary work-around, help would be much appreciated

Anyways, from Messageboxes I have determined that LibMain does not fire the %DLL_PROCESS_DETACH until after I have physically clicked a button to set the flag, so I can not programmatically set the flag, nor simulate a click to set the flag.
I thought about checking IsWindow, and pass the handle to the parent exe into the functions, but that does me no good if there is no parent window or the parent is the desktop.
I even thought about the hInstance, but since a dll is mapped into the parent instance, that does me no good either.
Is there some windows api that I can use to determine if the "Parent" is closing, so I can cleanly stop any routines that are not seeing the flag set? If it weren't for the idea that all the functions are in the same thread, I would look deeper at MCM's Waitable objects and being cancelled, but the size of the project is too huge to re-write from scratch, and a new project (I hope to make better since I can start it from scratch) takes priority.
Anyways anyone with a temporary work-around, help would be much appreciated

Comment