i build a multimedia timer control. and in groupproject works fine. but compiled gives an error and closes.
and in a module:Code:Option Explicit Private lTimerId As Long Event Timer() Dim lngInterval As Long Dim blnTimer As Boolean Public Property Get Enabled() As Boolean Enabled = blnTimer End Property Public Property Let Enabled(ByVal vNewValue As Boolean) If lngInterval < 1 Then Exit Property blnTimer = vNewValue If Ambient.UserMode = False Then Exit Property If blnTimer = True Then If lTimerId Then 'End Current Timer If lTimerId Then timeKillEvent lTimerId 'KillTimer lHwnd, lTimerId lTimerId = 0 End If End If lHwnd = UserControl.hwnd lTimerId = timeSetEvent(lngInterval, 0, AddressOf TimerRoutine, 0, TIME_CALLBACK_FUNCTION Or TIME_PERIODIC) 'lTimerId = SetTimer(lHwnd, 0, lngInterval, AddressOf TimerRoutine) ElseIf blnTimer = False Then If lTimerId Then timeKillEvent lTimerId 'KillTimer lHwnd, lTimerId lTimerId = 0 End If End If PropertyChanged "Enabled" End Property Public Property Get Interval() As Long Interval = lngInterval End Property Public Property Let Interval(ByVal vNewValue As Long) If vNewValue < 0 Then vNewValue = 0 If Enabled = True Then Exit Property lngInterval = vNewValue If lngInterval = 0 Then Enabled = False PropertyChanged "Interval" End Property Private Sub UserControl_Initialize() UserControl.MaskPicture = UserControl.Image UserControl.MaskColor = UserControl.Point(0, 0) End Sub Public Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 1000 Then RaiseEvent Timer End If End Sub Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Interval = PropBag.ReadProperty("Interval", 0) Enabled = PropBag.ReadProperty("Enabled", 0) End Sub Private Sub UserControl_Resize() UserControl.Width = 240 UserControl.Height = 240 End Sub Private Sub UserControl_Terminate() If lTimerId <> 0 Then timeKillEvent lTimerId 'KillTimer lHwnd, lTimerId lTimerId = 0 End If End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) PropBag.WriteProperty "Interval", Interval, 0 PropBag.WriteProperty "Enabled", Enabled, 0 End Sub
heres the image error ziped: http://www.megaupload.com/?d=3NMNR5M6.Code:Option Explicit Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal _ lpTimerFunc As Long) As Long Public Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Declare Function timeKillEvent Lib "winmm.dll" (ByVal uId As Long) As Long Public Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long Public Const TIME_PERIODIC = 1 ' program for continuous periodic event Public Const TIME_CALLBACK_FUNCTION = 0 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const WM_KEYDOWN = &H100 Public lHwnd As Long Public Function TimerRoutine( _ ByVal wTimerID As Long, ByVal iMsg As Long, _ ByVal dwUser As Long, ByVal dw1 As Long, ByVal dw2 As Long _ ) As Long 'Place your code here... On Error Resume Next SendMessage lHwnd, WM_KEYDOWN, 1000, 0 End Function
please tell me something. these error happens with compiled file![]()





Reply With Quote