vceGetHighMessageNumber

Returns the highest message number in an open voice object.

Prototype

DWORD vceGetHighMessageNumber ( VCEHD vh, unsigned *highmsg)

Argument

Description

vh

Handle of an open voice object.

highmsg

Pointer to the returned message number.


Return values

Return value

Description

SUCCESS

 

CTAERR_INVALID_HANDLE

vh is not a valid handle to an open voice object.

CTAERR_SVR_COMM

Server communication error.


Details

vceGetHighMessageNumber returns the message number of the highest numbered non-empty message in the voice object that vh specifies. The returned message number is VCE_UNDEFINED_MESSAGE if there are no messages in the voice object.

The highest message returned is not necessarily an indication of how many messages exist in a voice object. To count the number of actual messages, call vceGetMessageSize for each message number from zero (0) to highmsg inclusive, and add the messages that have non-zero sizes.

Use this function to determine the next message number to use (one more than highmsg) for a voice mail system where the messages must be maintained in chronological order even if deleted messages left gaps in the message numbers.

vceGetHighMessageNumber does not affect the current message.

See also

vceGetUniqueMessageNumber

Example

/* Count messages in a voice file */

unsigned myMessageCount (VCEHD vh)
{
    unsigned highmsg;
    unsigned message;
    unsigned msgsize;
    unsigned count = 0;

    vceGetHighMessageNumber (vh, &highmsg);
    if (highmsg == VCE_UNDEFINED_MESSAGE)
        return 0 ;

    for (message=0; message <= highmsg; message++)
    {
        vceGetMessageSize (vh, message, &msgsize);
        if (msgsize != 0)
            ++ count;
    }
    return count;
}