Hi,

 

   That looks pretty good,  and you could turn it into something like
this. I don't think that you really need to know the stream for the
Activate command, only the Connect command.  You could place this in a
module and call it anywhere from your application to look for the
existence of any window you want.  You may also want to put some other
logic in there to exit the loop after a certain period of time just in
case the window doesn't close.  I'm sure there are plenty of other ways
to go about this depending on your specific application though.

 

When you want to check a window you would simply do:

 

Public Sub Main

 

Dim tmpStarted as Date

tmpStarted= Now

 

Do While WindowClosed("AdminaStar Federal Express") = False or
Datediff("n",tmpStarted,Now()) > 1 ' you can put how many minutes you
want it to wait.

    DoEvents

    Wait .5

Loop

 

If WindowClosed("AdminaStar Federal Express") = False then 

    Msgbox "Uh-oh.... Doesn't look like the window closed.... I'd better
do something about it...."

    '<DO SOMETHING HERE>

End if

 

End Sub

 

Public Function WindowClosed(strWindowTitle as string) as Boolean

 

Dim Bos as New BostonWorkstation

On Error Resume Next

Err=0

 

Bos.Activate strWindowTitle

 

Select case Err

    Case 0

        WindowClosed = False

    Case Else

        WindowClosed = True

 

End Select

 

Set Bos = Nothing

 

End Function

 

 

 

 

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Davy Montgomery
Sent: Friday, February 08, 2008 10:39 AM
To: '[email protected]'
Subject: [Talk] Wait for Window to Close

 

Hello all I have a basic question.  I want to wait for a window to
close.  Currently I'm doing this I would love to know if there is a
better way of approaching the problem.  I'm still fairly new to the
product and learning my way around.  I wondered about using the "Active"
command; but I wasn't sure how I would know the name of the stream.

 

Dim WindowClosed As Boolean
WindowClosed = False
On Error Resume Next
Err.Clear
Do Until WindowClosed = True
    Activate "AdminaStar Federal Express"
    If Err.Number <> 0 Then
        WindowClosed = True
    End If
    Wait 30
Loop

 

 

Thanks,
Davy


CONFIDENTIALITY NOTICE: This email message, including attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and
destroy all copies of the original message.





CONFIDENTIALITY NOTICE: This message and any included attachments are from 
Salinas Valley Memorial Healthcare System and are intended only for the 
addressee.  The information contained in this message is confidential and may 
constitute inside or non-public information under international, federal, or 
state securities laws.  Unauthorized forwarding, printing, copying, 
distribution, or use of such information is strictly prohibited and may be 
unlawful.  If you are not the addressee, please promptly delete this message 
and notify the sender of the delivery error by e-mail or you may call Salinas 
Valley Memorial Healthcare System's Privacy Officer in Salinas, California, 
U.S.A. at (+1) (831) 755-0751.

Reply via email to