【发布时间】:2013-07-30 12:20:06
【问题描述】:
在 VB6 中,我们有以下代码。
g_CTimer.TimerID = SetTimer(0&, 0&, g_CTimer.Interval, AddressOf TimerProc)
TimerProc方法如下
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
我们如何在 C# 中转换该调用“AddressOf TimerProc”。
提前致谢。
问候 阿秋斯
【问题讨论】:
-
删除它。方法组被隐式转换为委托。 [
SetTimer(0, 0, g_CTimer.Interval, TimerProc)] -
使用pinvoke.net 网站查找正确的声明。但是,请不要为此烦恼,.NET Timer 类已经为您处理好了。
标签: c# vb6-migration addressof