bentom Posted April 22, 2011 Posted April 22, 2011 Hi, I did not find something on Timeouts when using a dllcall, perhaps someone could help. I use the mediainfo.dll to get some information on Video. The code is: $hDLL_mediainfo = DllOpen("mediainfo.dll") If $hDLL_mediainfo = -1 Then $rate="" Else ;New MediaInfo handle $Handle=DllCall($hDLL_mediainfo, "ptr", "MediaInfo_New") ;Open $Open_Result=DllCall($hDLL_mediainfo, "int", "MediaInfo_Open", "ptr", $Handle[0], "wstr", $videopath) ;Get with Stream=Video (ID1) Substream=0 (ID0) and Parameter=Framerate $framerate=DllCall($hDLL_mediainfo, "wstr", "MediaInfo_Get", "ptr", $Handle[0], "int", 1, "int", 0, "wstr", "FrameRate", "int", 1, "int", 0) $rate = $framerate[0] ;Delete MediaInfo handle $Handle=DllCall($hDLL_mediainfo, "none", "MediaInfo_Delete", "ptr", $Handle[0]) ;Close the DLL DllClose($hDLL_mediainfo) The Problem I have is this line $Open_Result=DllCall($hDLL_mediainfo, "int", "MediaInfo_Open", "ptr", $Handle[0], "wstr", $videopath) In some cases the mediafile doen not answer and the script pauses. I want to have a timeout here that sets an upper limit of 1min. Is there a timeout funktion for dll call or a general timeout for functions in scripts? Regards, Alex
PsaltyDS Posted April 22, 2011 Posted April 22, 2011 DllCall() is a blocking function in AutoIt. Find out if the DLL you are using supports a call-back function for that operation, and if so, use DllCallbackRegister() with it. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now