dushkin 1 Posted July 14, 2010 (edited) Hi guys. I wrote a DLL which presses an Outlook 2007 button, and upon this, a dialog is being displayed. The dialog has two buttons: Ok and Cancel. Opt ("WinTitleMatchMode", 4) $dll = DllOpen ("SparkOffice.dll") $result = DllCall($dll, "bool", "PressCommandBarButton", "str", "Outlook", "str", "Standard", "str", "Conference") ConsoleWrite ("DllCall Error = " & @error & @CRLF) ;the DllCall return value if $result[0] = 1 Then ;the function return value ConsoleWrite ("Result = true" & @CRLF) Else ConsoleWrite ("Result = false" & @CRLF) EndIf DllClose($dll) ConsoleWrite ("DllClose Error = " & @error & @CRLF) If WinExists("Win title") Then ConsoleWrite ("Found window" & @CRLF) WinClose("Win title") Else ConsoleWrite ("Not Found window" & @CRLF) EndIf I noticed that right after the dialog appears, the script halts! So I cannot detect it and surly cannot close it. Why is that? Only after I close the dialog manually, the script continues, and naturally it is useless... Can someone advice please? Edited July 14, 2010 by dushkin Share this post Link to post Share on other sites
PsaltyDS 39 Posted July 14, 2010 DllCall() is a blocking function. It doesn't return control to the script until the DLL returns. Your DLL evidently does not return until that dialog is closed. Nothing AutoIt can do about that. 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 Share this post Link to post Share on other sites
dushkin 1 Posted July 15, 2010 DllCall() is a blocking function. It doesn't return control to the script until the DLL returns. Your DLL evidently does not return until that dialog is closed. Nothing AutoIt can do about that.Well, you are right! It is really the DLL function with waits for the dialog closing..Thanks. Share this post Link to post Share on other sites
BitByteBit 1 Posted July 15, 2010 You could create another script to wait for the dialog box, then click ok when opened? Share this post Link to post Share on other sites