Question:
I created a simple abort dialog box with one button. During a long query I want to display my box so the user can abort. The dialog box creates a thread to monitor for the Abort button event. However the dialog box does not respond to any mouse events. How can I detect when the Abort button has been pressed?
Answer:
If you’re running the query in a thread, then you can kill the thread with acall to TerminateThread, which is a Windows API call. However, you shouldnote that it may be a bit dangerous to do this because the BDE will haveopen cursors to the tables that it’s accessing at the time.Your only other recourse would be to abort the thread in between queriesafter you’ve freed the BDE resources. If it’s a single query, then thatmeans going into the BDE, and that can be a complicated matter. I suggestyou get a book on BDE-level programming.