I have little problem with multithreading. I use CreateThread to create my own thread and create it when program starts (sorry but at this moment i cant use VCL threads). So my thread working with my VCL form. All program life second thread life too. But here one problem. When VCL form going to terminate my thread can check some form (class) params. Sure when my main form already terminated and some thread try to check methods in this form... then i got access violation.
How i can secured check params in my VCL form? Thanks!
here is my code.
unsigned int WINAPI CheckMutex( LPVOID lpParam )
{
const int def = 20;
int Cnt = def;
UnicodeString text;
while (1)
{
if (!UpdFrm || !UpdFrm->Label8 || UpdFrm->MutexTerminate)
break;
first im checking pointer to UpdFrm but VCL form can be terminated but pointer to form still alive. So thats why i check some controls for existing. And only after that i check MutexTerminate