Jump to content

Recommended Posts

Posted (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 by dushkin
Posted

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.

:blink:

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
Posted

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.

:blink:

Well, you are right! It is really the DLL function with waits for the dialog closing..

Thanks.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...