Sign in to follow this  
Followers 0
Zaxon

Recovering from a hung DLLCall statement

1 post in this topic

I have a script which uses a DLLCall to interact with another application. Specifically, it calls a DLL which interacts with Winamp. However, if winamp is unable to play the file it hangs. My main script, therefore, infinitely waits for the return of the DLLCall which will never come.

The solution I need is for my DLL calls to have a timeout. And seeing that the DLLCall statement doesn't have one, we need to provide a workaround for it. This is the assistance I'm needing.

The algorithm would go:

1) Call the DLL

2) Wait n seconds

3) If the DLL hasn't returned a result by then assume it has hung and take appropriate action

How do I achieve this? Since the DLLCall function will freeze the script completely in which it's called, the only workarounds I can see is to:

1) Write a c program which uses the DLL. Look for the name of the c program in the process list. If it still exists after n seconds, assume it has hung and kill the process

2) Write a second AutoIt script which makes the DLL call. Have the second script create a flag to indicate it is still running. If this flag exists after n seconds, assume it has hang and kill the second script

Does anyone have a more elegant solution for recovering from DLLs which hang?

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0