devxlogo

Abort DialogBox using Delphi 2.0 on NT 3.51

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.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Five Early Architecture Decisions That Quietly Get Expensive

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.