●●VB6转VS2005,AddressOf取得Funtion或Sub地址的问题●●
VB6的原代码:
API函数的定义:
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
API函数的调用:
lpPrevWndProc = SetWindowLong(lhWnd, GWL_WNDPROC, AddressOf WindowProc)
转到VS2005后,
lpPrevWndProc = SetWindowLong(lhWnd, GWL_WNDPROC, AddressOf WindowProc)
中,AddressOf WindowProc编译错误,因为SetWindowLong的第三个参数是Long型,而AddressOf是个Sub,没有返回值,类型不符。
请问如果解决?或者怎样才能取得WindowProc的地址?
谢谢!!!