![]() | Adding a Warning |
Defining custom warnings in an IVI driver allows you to return warnings with a proper COM HRESULT and a properly formatted warning message that can be displayed by various COM-aware IDEs. Internally, the errors and warnings defined for a particular driver are managed as members of a special enum created in the type library. Typically, the enum that houses all of the driver's error and warning code definitions has a name that ends with ErrorCodesEnum.
From Solution Explorer, double-click the Driver Designer node under the Nimbus node.
The Driver Designer opens as a tabbed document window. Select the IVI-COM tab.
From the tree view expand the type library node for the instrument-specific hierarchy. This node is named "<driverName>Lib".
Right-click on the Warnings node and choose Add Warning.
A new warning is added with a default name and the tree node enters edit mode.
With the warning node still in edit mode, type the desired name of the error and hit the Enter key.
![]() |
---|
By convention, warning names start with "S_<projectName>_". However, when typing an error name in the tree view, a shortened form of the name can be used. The "S_<projectName>_" prefix prefix can be excluded. For example, if the desired warning is S_ACME4321_SWEEP_BUSY, then type only SWEEP_BUSY and the full warning name will be expanded when the Enter key is pressed. |
When choosing a warning name, the following naming rules apply:
The name must be unique within the driver.
The name must contain only alphanumeric characters and the underscore (_) character.
Spaces are not allowed.
The name must be uppercase.
After the warning is added, the IVI-COM Warning General Editor appears in the right portion of the IVI-COM Designer. See the help topic for that Item Editor for details on defining the warning further.
If IVI-C wrapper generation is enabled on the IVI-C Page of the Driver Settings Editor, then an IVI-C warning is automatically created at this time and associated with the IVI-COM warning.
To view the linked IVI-C warning, right-click the IVI-COM warning, and choose Go to IVI-C Warning.
To remove the linked IVI-C warning, thereby creating an IVI-COM-only warning, right-click the IVI-COM warning, and choose Delete IVI-C Warning.