Functions, when called from VB, throw an exception on error. The following table lists the possible HRESULT errors that may be encountered:
C++ define |
Hex value |
Hex codes in VB |
Description |
---|---|---|---|
S_OK |
0 |
No exception |
Successful execution |
E_INVALIDARG |
80070057 |
5 |
One or more arguments are out of range |
E_HANDLE |
80070006 |
80070006 |
No active object (page or graphical object) |
E_POINTER |
80004003 |
80004003 |
Missing or broken link encountered |
E_ABORT |
80000007 |
11F |
Enumeration terminated or function manually canceled (for example ProjectUpdate) |
E_FAIL |
80004005 |
80004005 |
Every other error |
The following VB code can be used to process the error code:
On Error Resume Next
Err.Clear
GraphicsBuilder.LibObjectName Project, File, Page, Type
If Err.Number <> 0 Then
Debug.Print "Error occurred in LibObjectName"
End If
Note the following points:
The functions in the groups Page Functions, Options Functions, Object Drawing and Property Functions, Text Property Functions and the individual functions LibSelectionHooksEnabled, SelectionEventEnabled, BrokenLinkCancelEnabled and Visible are treated as variables in VB.
When calling these functions from C++, you need to use a "put_" or "get_" prefix, for example, "put_Visible(TRUE)", "get_Visible(bValue)" to set or fetch the values, except if the Attribute is read-only. In this case the function is the same in C++; for example, PageName.
To evaluate the correct function name for C++ reference the Type library CTDRAW32.TLB, which can be found in CitectSCADA's BIN directory. You can use Microsoft's Visual Studio Tool OLE / COM Object Viewer (select menu File | View Typelib...) to look at a type library.
See Also