i fix it:so that it doesn't crash when debugging or when something goes wrong with the code
Code:
function pvWndProc(***)
on error goto err1
***code

Exit Function
ERR1:
Dim lID As Long
lID = dwRefData Xor hWnd
Debug.Print "SubClassErr:" & Err.Description & ",obj=" & lID
pvWndProc = DefSubclassProc(hWnd, uMsg, wParam, lParam)
pvWndProc = RemoveWindowSubclass(hWnd, GetpvWndProc, lID)
end function