CustomProcess_Cleanup Function

Applies To: Implementing a custom process

Cleans up variables and destroys the client handle, freeing up any allocated memory.


  CustomProcess_API BOOL __stdcall CustomProcess_Cleanup(void* clientHandle);


[in] clientHandle

Unique ID used to identify the caller.

The client handle is not supposed to be used after the cleanup function. This is generally the last function called for one particular client handle.

Return Value

A Boolean value signifying if the client handle was successfully cleaned up.

Reporting errors and warnings: Any errors can be obtained by calling the GetLastError function which will give out the error message for the last error in the dll.


The following example represents a partial C++ implementation of this function:


typedef struct


    AreaOfInterest* myAoi;

    NVM* myProcessProps;

    unsigned long myNumProps;

    CustomRasterInfo* myOutputRasterInfo;

    unsigned long bufferSize;

    char errorString[2048];

    unsigned char* myOutputBuffer;

    void* myCallbackObject;

    NVM* myProcessMetadata;

    unsigned long myNumMetadata;

    tGetRowfn myGetRowfn;

    tGetPropertyfn myGetPropertyfn;

    tCreateAuxRasterfn myCreateAuxRasterfn;

    tGetAuxRowfn myGetAuxRowfn;



CustomProcess_API BOOL __stdcall CustomProcess_Cleanup(void* clientHandle)


    ClientHandle* myClientHandle = (ClientHandle*)clientHandle;

    unsigned long i = 0;


    myClientHandle->myAoi = 0;

    myClientHandle->myProcessProps = 0;

    myClientHandle->myOutputRasterInfo = 0;


    myClientHandle->myCallbackObject = 0;

    for (;i < myClientHandle->myNumMetadata; ++i)






    myClientHandle->myGetRowfn = 0;

    myClientHandle->myGetPropertyfn = 0;

    myClientHandle->myCreateAuxRasterfn = 0;

    myClientHandle->myGetAuxRowfn = 0;


    return TRUE;


For a detailed example on how to implement this function, see Sample custom process.

Related Topics

See also: CustomProcess_Create, CustomProcess_SetWindow, CustomProcess_Initialize, CustomProcess_GetRow, CustomProcess_GetMetadata, CustomProcess_GetLastError, CustomProcess_SetCallbackFunctions, CustomProcess_SetAreaOfInterest, CustomProcessUI_Init, CustomProcessUI_ShowModalDialog, CustomProcessUI_GetUpdatedXML, CustomProcessUI_GetStatus, CustomProcessUI_GetProperty, CustomProcessUI_SetProperty