ChemDraw Menu Extensions
Interface:  Access Functions

ChemDraw exports a number of access functions for use in your menu extension.

CDIsStructureSelected may be used to determine if a submenu item should be enabled.

Modification of the document is supported through CDCutCurrentSelection, CDPasteSelection, CDClearCurrentSelection, CDSelectAll, and CDUnselectAll.  Non-obtrusive copies of document information can also be obtained through CDCopyCurrentSelection and CDCopyDocument, while a new document can be created with a call to CDNewDocument, and an existing one can be opened with a call to CDOpenDocument.

Document and application preferences can be set and retrieved from ChemDraw using the CDGetDocumentSetting, CDSetDocumentSetting, CDGetApplicationPreference, and CDSetApplicationPreference calls.  These settings will be persistent across multiple executions of ChemDraw, provided the settings are actually saved by the user.

If a ChemDraw access function returns an error, then the DLL can call CDGetApplicationErrorString for a string containing a description of the error.

Many of these access functions pass information back and forth using handles. As a rule, if ChemDraw allocated the memory for the handle, then the handle should be released using the CDReturnHandle call. If the DLL allocated the handle, then ChemDraw will copy the information, and the DLL is responsible for releasing the memory. Handles that are allocated by the DLL and passed to ChemDraw, for example in the CDPasteSelection call, can release the memory as soon as the function returns from ChemDraw.

Many of the calls in this file either require or return a "documentToken". This identifier is unique to a particular ChemDraw document in the current ChemDraw process, but does not persist across sessions. If multiple instances of ChemDraw are running on a machine, the documentToken is not unique to that machine, but only to the particular instance of ChemDraw.

2005 CambridgeSoft Corporation. All Rights Reserved. Privacy Statement
Tel  800 315-7300 / 617 588-9300     Fax  617 588-9390     Email
CambridgeSoft Corporation, 100 CambridgePark Drive, Cambridge, MA 02140 USA