Dear Dilution,
yes i know i can call the EndThreadFunction1 in either the main thread or the execution thread. It's just that this simple project is to simulate my actual program. 
Let me explain and see if i am going about the correct way for this multi-threading.
Originally in my program, i use 
CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, ExecutionThread, NULL, &ExeThreadID);
CmtWaitForThreadPoolFunctionCompletion (DEFAULT_THREAD_POOL_HANDLE, ExeThreadID, OPT_TP_PROCESS_EVENTS_WHILE_WAITING);
CmtReleaseThreadPoolFunctionID (DEFAULT_THREAD_POOL_HANDLE, ExeThreadID);	
"updates stuff"
after i press stop, i realise that it takes quite some time before the program actually reacts and the msg appeared.
Stop Callback ()
{
message popup ("Program Terminated")
do some other stuff //sets flags etc
}
So i thought maybe it has something to with RunUserInterface, so i change it to
CmtScheduleThreadPoolFunctionAdv (DEFAULT_THREAD_POOL_HANDLE, ExecutionThread, NULL, THREAD_PRIORITY_NORMAL, EndExeThread, EVENT_TP_THREAD_FUNCTION_END, NULL, CmtGetCurrentThreadID(), NULL));
// Where EndExeThread "Updates Stuff'
can't remember why i changed it later to RUN_IN_SCHEDULED_THREAD.....
By the way, if it is run in the main thread, which will be process first? the stop callback or the EndExeThread
After i did all this, when i execute the program on a win98 pc then the problem first occured. 
This was developed on a winNT system.
By the way, on winNT, i notice that when i press the stop button in my program, it appears to take some time before i see a slow reaction in the stop button being depressed then the popup appears. But this is not so for the win98 or winxp system. Any ideas why?
Thanks
Regards
AL
Message Edited by AL on 05-11-2005 02:32 AM