[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ProgSoc] VB Query
Paul,
The Activate event won't trigger when you restore a minimised VB app...
Quoted from docs:
"The Activate and Deactivate events occur only when moving the focus within
an application. Moving the focus to or from an object in another
application doesn't trigger either event."
Also, I tried a test to see what would happen to an endless loop if called
from an event that is triggered multiple times - to see how the endless
loops might work when called over and over.
It seems (since VB apps are not multi-threaded I suppose) that each time
an event with an endless loop is triggered the currently running code is
stopped and re-executed.
Daniel Owen
btw:
The code I used to test this was:
Private Sub Form_Click()
Static clickCount As Integer
clickCount = clickCount + 1
If clickCount <= 1 Then
' Start this endless loop with first click on form
' Test if it will keep printing "Loop 1" forever...
' ...(even after Loop 2 has started)
Do
Debug.Print "Loop 1. clickCount=" & clickCount
DoEvents
Loop While 1 = 1
Else
' start this next endless loop with subsequent clicks on form
Do
Debug.Print "Loop 2. clickCount=" & clickCount
DoEvents
Loop While 1 = 1
End If
End Sub
On Thu, 12 Dec 2002 thespus@nospam.progsoc.uts.edu.au wrote:
> Hi guys,
>
> I was wondering if someone could tell me what happens in the following scenario:
>
> There is a infinite loop in the Form.Activate procedure with a DoEvents command
> so that events can be handled. I assume the loop keeps running if the program is
> minimized. What happens when the program is restored? Does it trigger the
> execution of the Form.Activate procedure?
>
> Thanks in advance,
> Paul
>
> -
> You are subscribed to the progsoc mailing list. To unsubscribe, send a
> message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
> If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.
>
-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.