dushkin Posted July 14, 2010 Share 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 14, 2010 Share 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 Link to comment Share on other sites More sharing options...
dushkin Posted July 15, 2010 Author Share 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. Link to comment Share on other sites More sharing options...
BitByteBit Posted July 15, 2010 Share Posted July 15, 2010 You could create another script to wait for the dialog box, then click ok when opened? 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