Option Explicit
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Function TimerCreate() As Boolean
If g_CTimer Is Nothing Then Exit Function
' Create the timer
g_CTimer.TimerID = SetTimer(0&, 0&, g_CTimer.Interval, AddressOf TimerProc)
If g_CTimer.TimerID Then
TimerCreate = True
Else
TimerCreate = False
g_CTimer.TimerID = 0
End If
End Function
Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
On Error Resume Next
If g_CTimer Is Nothing Then Exit Sub
g_CTimer.ThatTime
End Sub
答案 0 :(得分:1)
对于计时器,您可能需要:
System.Threading.Timer myTimer =
new System.Threading.Timer(TimerProc, null, g_CTimer.Interval, g_CTimer.Interval);
如果你真的需要使用多媒体计时器(我不推荐它),我建议你阅读Windows Timers并查看pinvoke.net以获取托管原型。例如,SetTimer。