Your driver receives ICM_COMPRESS_END when the client application no longer needs data compressed, or when the client application is changing the format or palette. After sending ICM_COMPRESS_END, the client application must send ICM_COMPRESS_BEGIN to continue compressing data. The client application does not need to send an ICM_COMPRESS_END message for each ICM_COMPRESS_BEGIN message. It can send ICM_COMPRESS_BEGIN to restart compression without sending ICM_COMPRESS_END.
When the driver is no longer needed, the system closes it by sending DRV_CLOSE.