dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
May 2, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Canceling a call to a dll

Question:
In a program, I'm calling a function in a dll. The time before that function is finished can vary from a few seconds to an hour, depending on the start values and how big the problem is.

I want the user to be able to cancel if he/she thinks it takes too long, and perhaps start over with other start values.

I've tried to call the dll in a thread, using createThread, and then closing the thread when the user presses the cancel button. But I get strange errors, and I can't find where they occur.

Is there another way to cancel a call to a dll? Or is there a good example of how to solve it with a thread somewhere?

Answer:
Here's one way to do it. Declare an event in the DLL with a Boolean parameter. In the long running function, periodically raise the event and check the Boolean parameter to see whether the user canceled it.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date