CustomProcess_SetWindow Function

Applies To: Implementing a custom process

Set the area of interest in rows and columns.

This defines the part of the image that is being processed. This information is used to calculate the size of the output row buffer returned by the CustomProcess_GetRow function. If required, the size of the window can be changed by the process if it requires more pixels.


CustomProcess_API int __stdcall CustomProcess_SetWindow(

    void* clientHandle, unsigned long* startCol, unsigned long* startRow,

    unsigned long* endCol, unsigned long* endRow);


[in] clientHandle

Unique ID used to identify the caller.

[in] startCol

Start column of the area of interest window.

[in] startRow

Start row of the area of interest window.

[in] endCol

End column of the area of interest window.

[in] endRow

End row of the area of interest window.

Return Value

Return value that communicates if the window has been changed.

0: Error
1: Window changed.
Anything else: Window Unchanged.

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:


CustomProcess_API int __stdcall CustomProcess_SetWindow(

    void* clientHandle, unsigned long* startCol, unsigned long* startRow,

    unsigned long* endCol, unsigned long* endRow)


    ClientHandle* myClientHandle = (ClientHandle*)clientHandle;


    myClientHandle->bufferSize =

        (*endCol - *startCol) * myClientHandle->myOutputRasterInfo->BandsPerPixel;


    if (!myClientHandle->bufferSize)


        strcpy_s(myClientHandle->errorString, 2048,

            "SetWindow failed. BufferSize is zero.");

        return 0;



    myClientHandle->myOutputBuffer = malloc(

        myClientHandle->bufferSize * sizeof(unsigned char));


    /// A return value of 2 signifies no change in the window

    return 2;


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

Related Topics

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