I've stumbled upon one of those mysterious coding bugs that drives all of us crazy. I was removing some code in Form A, adding some new code in Form B and Class A, and when I try to compile my project, I'm getting an error in a BAS file that I haven't touched in weeks. I use the following function to help me find information in the registry, and I don't see why any of my changes should've caused the compiler to blow up in an unrelated BAS module.Compile Error: Type-declaration character does not match declared data type. Any ideas?VB Code:
Private Function Query_ValueEx(ByVal lhKey As Long, ByVal szValueName As String, vValue As Variant) As Long On Error GoTo QueryValueExError Dim cch As Long Dim lrc As Long Dim lType As Long Dim lValue As Long Dim sValue As String lrc = RegQueryValueExNULL(lhKey, szValueName, 0&, lType, 0&, cch) If lrc <> m_ERROR_NONE Then Error 5 Select Case lType Case m_REG_SZ: sValue = String(cch, 0) lrc = RegQueryValueExString(lhKey, szValueName, 0&, lType, sValue, cch) If lrc = m_ERROR_NONE Then vValue = Left$(sValue, cch) '<--- ERROR HERE Else vValue = Empty End If Case m_REG_DWORD: lrc = RegQueryValueExLong(lhKey, szValueName, 0&, lType, lValue, cch) If lrc = m_ERROR_NONE Then vValue = lValue Case Else lrc = -1 End Select QueryValueExExit: Query_ValueEx = lrc Exit Function QueryValueExError: Resume QueryValueExExit End Function




Reply With Quote