[求助]"AddressOf”表达式无法转换为“Integer ”,因为“Integer”不是委托类型。
报错语句:TimerID = SetTimer(FormHwnd, 0, 100, AddressOf TimerProc)
相关语句:
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Int32, ByVal nIDEvent As Int32, ByVal uElapse As Int32, ByVal lpTimerFunc As Int32) As Int32
Sub TimerProc(ByVal hwnd As Int32, ByVal uMsg As Int32, ByVal idEvent As Int32, ByVal lngSysTime As Int32)
Dim OldMousePos As POINTAPI, NewMousePos As POINTAPI
Dim FormRECT As RECT
Dim FormWidth As Int32, FormHeight As Int32
GetCursorPos(NewMousePos)
If NewMousePos.x = OldMousePos.x And NewMousePos.y = OldMousePos.y Then Exit Sub
OldMousePos = NewMousePos
GetWindowRect(FormHwnd, FormRECT)
FormDC = GetWindowDC(FormHwnd)
DeskDC = GetWindowDC(0)
FormWidth = FormRECT.Right - FormRECT.Left
FormHeight = FormRECT.Bottom - FormRECT.Top
UpdateWindow(FormHwnd)
StretchBlt(FormDC, 0, 0, FormWidth, FormHeight, DeskDC, NewMousePos.x - FormWidth / 2 / ZoomCount, NewMousePos.y - FormHeight / 2 / ZoomCount, FormWidth / ZoomCount, FormHeight / ZoomCount, SRCCOPY)
ReleaseDC(FormHwnd, FormDC)
ReleaseDC(0, DeskDC)
End Sub
感谢能有高手指点下。