The wpAddToObjUseList method adds items to the object's in-use list. When an object's memory is allocated, wpAllocMem calls wpAddToObjUseList to add a USAGE_MEMORY item to the object's in-use list. The allocated memory immediately follows the MEMORYITEM data structure. The following figure shows the syntax of the MEMORYITEM data structure:
typedef struct _MEMORYITEM { ULONG cbBuffer; /* Number of bytes in memory block */ }MEMORYITEM;
The wpOpen method calls wpAddToObjUseList to add a USAGE_OPENVIEW item to the object's in-use list. The wpSwitchTo method scans the in-use list for USAGE_OPENVIEW items to give focus to an already existing view. In general, wpViewObject is used instead of wpOpen because wpViewObject considers the setting in the Object open behavior group-box control on the Window page of the Settings notebook, and calls either wpOpen or wpSwitchTo. The following figure shows the syntax of the VIEWITEM data structure:
typedef struct _VIEWITEM { ULONG view; /* Object view that this represents */ LHANDLE handle; /* Open handle */ ULONG ulViewState; /* View state flags */ HWND hwndCnr; /* Used only by system */ PMINIRECORDCORE pRecord; /* Used only by system */ }VIEWITEM;
When wpSetLinkToObject is called to link a shadow to the object it points to, wpAddToObjUseList is called to add the USAGE_LINK item to the original object's in-use list. The following figure shows the syntax of the LINKITEM data structure:
typedef struct _LINKITEM { WPObject *LinkObj; /* The link object */ }LINKITEM;
When a data file is opened, its associated program is started and a USAGE_OPENFILE use-item is added to the data file's in-use list. The following figure shows the syntax of the VIEWFILE data structure:
typedef struct _VIEWFILE { ULONG ulMenuId; /* Menu id if association or menu page */ LHANDLE handle; /* Open handle */ HWND hwndCnr; /* Used only by system */ PMINIRECORDCORE pRecord; /* Used only by system */ }VIEWFILE;