onMinimize - Event availible ?

  • Thread starter Thread starter Nieurig
  • Start date Start date
N

Nieurig

Hello folks,
i need to disable a running timer if the Access-Mainform
was minimized.
How can I solve this?

Thanks in advance for any help.
Niels
 
I think this can help you :

The Deactivate event occurs when the form or report loses the focus to a
Table, Query, Form, Report, Macro, or Module window, or to the Database
window.

The OnDeactivate value will be one of the following, depending on the
selection chosen in the Choose Builder window (accessed by clicking the Build
button next to the On Deactivate box in the form or report's Properties
window):

- Raoul
 
Hi Raoul,
thanks for your comment.
The Deactivate event occurs when the form or report loses the focus to a
Table, Query, Form, Report, Macro, or Module window, or to the Database
window.
Well, but I have set the database window to hidden and it
don't occurs when the Access-Mainform was iconified.
The OnDeactivate value will be one of the following, depending on the
selection chosen in the Choose Builder window (accessed by clicking the Build
button next to the On Deactivate box in the form or report's Properties
window)
I can't translate (understand) this.
From which point i can get a VALUE ?
I can RUN code by deactivating the form (actually i use
this to save the current record of the form) but is there
any information about which object get the focus availible?

Niels
 
Nieurig said:
Hello folks,
i need to disable a running timer if the Access-Mainform
was minimized.
How can I solve this?

Thanks in advance for any help.
Niels

The form's Resize event will fire whenever the size of the form changes,
including when it is minimized. So all you have to do is check, in that
event, to see if the form is minimized. You can call the "IsIconic"
Windows API function to determine this. So you might hjave code like
this in your form's module.

'----- start of code -----
Option Compare Database
Option Explicit

Const conInterval = 1000 ' every second
'*** SET YOUR DESIRED TIME INTERVAL HERE

Private Declare Function apiIsIconic _
Lib "user32" Alias "IsIconic" (ByVal hwnd As Long) As Long

Private Sub Form_Resize()

If apiIsIconic(Me.hwnd) Then
Me.TimerInterval = 0
Else
If Me.TimerInterval = 0 Then
Me.TimerInterval = conInterval
End If
End If

End Sub

Private Sub Form_Timer()

' your timer code here ...

End Sub

'----- end of code -----
 
Back
Top