i don't have sure how i fix the bug, but seems that my program resulve it
i wanted a program for turn off the screen after sometime. then i look for some code and i update it:
Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
Const SC_MONITORPOWER = &HF170&
Const MON_OFF = 2&
Const WM_SYSCOMMAND = &H112
Private Sub procTurnOff()
SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, MON_OFF
End Sub
Private Sub Command1_Click()
Timer1.Enabled = False
End Sub
Private Sub Command2_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyS And Shift = vbCtrlMask Then
Timer1.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
Call procTurnOff
End Sub
after use 1 or 3 times, i notice that the bug was resolved.
thanks