From Vectorworks Developer
Jump to navigation Jump to search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

What is this?

Every VCOM:VCOM (VectorWorks Component Object Model) interface function returns an error code. Each interface can define its own set of error result codes.

typedef	long		VCOMError;

Note When checking the result from VCOM functions, you must check the VCOMError result. You should not 'if' directly the result since that will behave unexpectedly because '0' === 'no error', 'non zero' === 'error'

See macros VCOM_SUCCEEDED and VCOM_FAILED below.

Default error codes

There is a set of predefined error codes:

Constant Name Value Description
kVCOMError_NoError 0 The function succeeded. No Error!
kVCOMError_Failed 1 The function failed.
kVCOMError_False 2 The function responded with 'false' (negative)
kVCOMError_OutOfMemory 3 The function failed because of lack of memory.
kVCOMError_NotInitialized 4 The interface instance is not properly initialized.
kVCOMError_NoInterface 5 During SDK:GS_VWQueryInterface or VCOM:VCOMPtr notifying that there is no instance with requested VCOM:VWIID.
kVCOMError_NotImplemented 6 Function is not yet implemented.
kVCOMError_DuplicateIID 10 During SDK:GS_VWRegisterInterface notifying that interface with specified VCOM:VWIID already registered.
kVCOMError_NoModule 11 During SDK:GS_VWRegisterInterface notifying that there is no such module that is registering itself as VCOM provider.
kVCOMError_NoInstance 12 During SDK:GS_VWQueryInterface or VCOM:VCOMPtr notifying that VCOM:VWIID is found but instance cannot be created.
kVCOMError_Unexpected 13 Unexpected condition in the function. Usually an internal error for the function.
kVCOMError_InvalidArg 15 Invalid argument(s) were passed to the function.


#define VCOM_SUCCEEDED(x)  (x == kVCOMError_NoError)

Returns true if a VCOM function call succeeds.

if ( VCOM_SUCCEEDED( pInterface->Fun() ) ) {
   // ... the call has succeeded!


#define VCOM_FAILED(x)  (x != kVCOMError_NoError)

Returns true if a VCOM funtion call DOES NOT succeed.

if ( VCOM_FAILED( pInterface->Fun() ) ) {
   // ... the call has NOT succeeded!