This example demonstrates selecting an object from a database using its handle. The handle provides
an unique identification of an object being resident inside a database.
The EntryObjectByHandle() function requires a pointer to the database object in which an object must
be searched by handle as the first argument, a pointer to the class description instance to which an object
must be belonged as the second argument, and returns the smart pointer of the found object or NULL if the
specified handle is not found in the database or the found object does not belong to the specified class.
This function declares a variable of an unsigned 64-bit integer type and inquires a value for a handle
as an integer number in the hexadecimal format. If the entered value is incorrect, the function displays
an error message. If the entered value is correct, the function calls the getOdDbObjectId() method of the
database object and passes to it the entered value. This method returns the object ID. If the returned ID
is kNull, the handle is not found and function displays an error message. If the returned ID is correct,
the function opens the object associated with this ID in the writing mode using the safeOpenObject() method.
If the object is not opened, the function displays an error message. Next, the function checks the class
type of the opened object using the isA() method. If classes are different, the function displays an error
message.
The EntryObjectByHandle() function has the following implementation: