SHIsEmptyStream

This function tests whether a stream is empty.

Declaration

BOOL SHIsEmptyStream (LPSTREAM pstm);

Parameters

The pstm argument provides the address of an IStream interface to some stream object.

Return Value

The function returns TRUE if the stream is empty, else FALSE.

Behaviour

If the stream’s Stat method succeeds, the function returns TRUE if the size so obtained is zero, else FALSE.

If the Stat method fails, the function tries to read 4 bytes from the stream. If the read fails to produce exactly 4 bytes, the function infers (surely without ground) that the stream is empty, and returns TRUE. If it can read 4 bytes, it resets the stream’s seek pointer to zero and returns FALSE.

Availability

The SHIsEmptyStream function is exported from SHLWAPI as ordinal 166 in version 5.00 and higher.

Though this function dates from as long ago as 1999, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.