DocDestroy closes the given document, frees any memory that the document occupied and destroys the document handle.

bool = DocDestroy(hDoc)
bool = DocDestroy(hDoc, options)

Return Value

If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0).



Identifies the document.


The options parameter sets the packing option for IPZ files. The parameter has no meaning for IPW files.

Value Description
DOC_CLOSE_DEFAULT (0) Default. During closing of an IPZ file the registry setting Settings\ipz-pack-on-close will be evaluated. If the value is not specified or set to 1 the file will be packed in an external process.
DOC_CLOSE_NOPACK (1) No packing. The file will be closed and it can immediately accessed by any process.
DOC_CLOSE_PACK_EXTERNAL (2) External process will pack the file. While the external process is running the file cannot be accessed.
DOC_CLOSE_PACK_INTERNAL (3) Internal process will pack the file.


  • IPZ files are almost always smaller than IPW files, because the data is compressed.
  • It has no speed impact on opening or editing an IPZ file, if the file is compacted or not.
  • During compacting an IPZ file, duplicate data streams are removed. For example if a file contains two datasets, which use the same x-channels, one of the two x-channles will be removed. Two channels are identical, if all values in the channels are identical. In a second step, all unused elements like pages, datasets, bitmaps, maps and OLE objects will be removed.


Version Description
R2012.10 New parameter options.