step887 Posted August 24, 2016 Share Posted August 24, 2016 I am calling a custom dll (x86 and x64 specific versions) Since the x64 dll requires x64 exe, I have "wrapper" that installs the dll/exe for the right OSArch. The dllcall is correct and works 99% of the time, but sometimes the dllcall will hang due outside influences beyond my control. Is there a way terminate a dllcall? I do not see a way within the help file. The work around I have come up with should work, but does not always work. i suspect that whatever is hanging up the dllcall is preventing the processclose from working.. $exe = @WindowsDir & '\test.exe' If @OSArch = 'x64' Then FileInstall('x64.exe', $exe, 1) Else FileInstall('x86.exe', $exe, 1) EndIf Global $gtime = TimerInit() AdlibRegister('gtimeout', 60000) RunWait($exe,@windowsdir,@sw_hide) AdlibUnRegister("gtimeout") Func gtimeout() If TimerDiff($gtime) > 1000 * 60 * 10 Then ProcessClose('test.exe') $file = FileOpen('log.txt',1) FileWriteLine($file, 'Hard Time-out reached. Exiting...' ) FileClose($file) EndIf EndFunc ;==>gtimeout Right now, it just logs that hard time-out reached over and over. So is there anyway to kill the dllcall? Or ensure I can kill the test.exe process? Link to comment Share on other sites More sharing options...
JohnOne Posted August 24, 2016 Share Posted August 24, 2016 I doubt dllcall has hung if that adlib works. Anyway best treat cure the problem than mask the symptoms, what is beyond your control? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
step887 Posted August 25, 2016 Author Share Posted August 25, 2016 Hi John, The Adlib is the wrapper, the dllcall is in the test.exe, so they are separate processes. The Wrapper is monitoring test.exe and trying to close it after 10 minutes. The dll is part of third party installation, I suspect that dllcall fails because the installation is broken. But I can't control that. So if there is not a way to cancel the dllcall, is there a better way to make sure the process ends? Link to comment Share on other sites More sharing options...
JohnOne Posted August 25, 2016 Share Posted August 25, 2016 (edited) It does not matter If dllcall is in separate process, RunWait is a blocking function so that adlib will not even be called until exe has finished, and exe will not finish untill dllcall has returned. The problem lies elsewhere. EDIT: Although the adlib function may be called however many times 60000 (1 minute) goes into however long it takes exe to finish. The script is the same as this... AdlibRegister("_func") MsgBox(0,0, "Main body") AdlibUnRegister("_func") Func _Func() MsgBox(0,0,"_Func") EndFunc Edited August 25, 2016 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
step887 Posted August 25, 2016 Author Share Posted August 25, 2016 No I disagree, create test.exe: MsgBox(0,@ScriptName,"do not click") Then use this to run the test.exe Global $gtime = TimerInit() AdlibRegister('gtimeout') RunWait('test.exe',@ScriptDir) AdlibUnRegister("gtimeout") Func gtimeout() If TimerDiff($gtime) > 1000 * 15 Then ProcessClose('test.exe') $file = FileOpen('log.txt',1) FileWriteLine($file, 'Hard Time-out reached. Exiting...' ) FileClose($file) EndIf EndFunc ;==>gtimeout I am using "wrapper" process to monitor a subprocess, but my subprocess is not responding to processclose like the above example. Link to comment Share on other sites More sharing options...
JohnOne Posted August 25, 2016 Share Posted August 25, 2016 Well bruise my hole with a welly, I thought RunWait() was blocking function, appears not. My apologies. Still, I'd think about why the dllcall is hanging its process, since it cannot be stopped once it is started. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 25, 2016 Moderators Share Posted August 25, 2016 JohnOne, Quote I thought RunWait() was blocking function It is. Run this: AdlibRegister("_Func", 1000) RunWait("notepad.exe") ConsoleWrite("Arrived here at " & @SEC & "!" & @CRLF) Func _Func() ConsoleWrite("Adlib at " & @SEC & @CRLF) EndFunc The Adlib fires every second as that is using a timer from outside the script itself - the final ConsoleWrite waits until you close the Notepad window. M23 JohnOne 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JohnOne Posted August 25, 2016 Share Posted August 25, 2016 Handy to know you can continue to perform some tasks while runwait is ... running, and... waiting. So what blocking funcyions can adlib work around I wonder, cause the same behaviour is not the case with msgbox. @step887 does task manager end the process? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 25, 2016 Moderators Share Posted August 25, 2016 JohnOne, I imagine the difference is that RunWait is waiting for an external program to terminate, whereas MsgBox is internal to the script itself - but I am not at all sure of that. M23 JohnOne 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
step887 Posted August 27, 2016 Author Share Posted August 27, 2016 @JohnOne Yes Task manager is able to kill the process. I guess I could try taskkill.. Link to comment Share on other sites More sharing options...
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