home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "dwErrors"
- ' Desaware API Toolkit object library
- ' Copyright (c) 1996 by Desaware Inc.
- ' All rights reserved
-
- Option Explicit
-
- #If Win32 Then
- Public Declare Function GetLastError& Lib "kernel32" ()
- #End If
-
- ' List of errors
- ' Errors over 30000 have vbObjectError added
- ' others are VB errors
- Public Const DWERR_APIRESULT = 30000
- Public Const DWERR_UNINITIALIZED = 30001
- Public Const DWERR_NODCAVAILABLE = 30002
- Public Const DWERR_ISMETAFILEDC = 30003
- Public Const DWERR_NOTMETAFILEDC = 30004
- Public Const DWERR_NOTINWIN16 = 30005
- Public Const DWERR_INVALIDPARAMETER = 30006
- Public Const DWERR_COUNTMISMATCH = 30007
-
-
- Public Sub RaiseError(ByVal errnum%, classname$)
- Dim desc$
-
- If errnum < 30000 Then
- Err.Raise errnum, classname
- Else
- Err.Raise vbObjectError + errnum, classname, GetErrorDesc(errnum)
- End If
- End Sub
-
- ' Return description of class error >= 30000
- Private Function GetErrorDesc(ByVal errnum)
- Dim desc$
- If errnum < 30000 Then Exit Function
-
-
- Select Case errnum
- Case DWERR_APIRESULT
- desc$ = "API Result error"
- Case DWERR_UNINITIALIZED
- desc$ = "Object is uninitialized"
- Case DWERR_NODCAVAILABLE
- desc$ = "Device Context is unavailable"
- Case DWERR_NOTMETAFILEDC
- desc$ = "This Device Context is not a Metafile Device Context, so this procedure does not apply to it"
- Case DWERR_ISMETAFILEDC
- desc$ = "This Device Context is a Metafile Device Context, so this procedure does not apply to it"
- Case DWERR_NOTINWIN16
- desc$ = "This function does not exist in 16-bit Windows."
- Case DWERR_INVALIDPARAMETER
- desc$ = "Invalid function parameter"
- Case DWERR_COUNTMISMATCH
- desc$ = "Counts of different collections do not match"
- End Select
-
- GetErrorDesc = desc$
- End Function
-
-