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 -----