VpeCloseDoc

<< Click to Display Table of Contents >>

Navigation:  Management Functions >

VpeCloseDoc

Previous pageReturn to chapter overviewNext page

Closes the specified document (and also the preview, if open).

int VpeCloseDoc(

VpeHandle hDoc

)

VpeHandle hDoc

Document Handle

Returns:

Value

Description

True

Ok

False

couldn’t close, because the document is currently printed

Remarks:

You may call this method with hDoc = NULL. In this case the function will return True. This is the only method of VPE where hDoc may be NULL.

 

Note: when a window which contains the VPE Control is being closed, it is very important that you call VpeCloseDoc(). You need to call VpeCloseDoc() exactly at the time when receiving the event which asks for confirmation if the form can be closed. (For Windows applications this is the WM_CLOSE event.)
In case VpeCloseDoc() should return False in that moment, you need to cancel the process of closing the window, i.e. the window must not be closed.

 

Example for C/C++:

case WM_CLOSE:

 if (        !VpeCloseDoc(hDoc1) || !VpeCloseDoc(hDoc2))

 {

       Msg("The application cannot terminate until all jobs have finished printing.");

         return 0;

 }

 DestroyWindow(hwnd);

 return 1;

In the above examples the window controls two VPE documents named "hDoc1" and "hDoc2". For both documents it is checked whether their previews can be closed or not.