The LlmGetMessageById function retrieves a specific message and
its associated response from the client session history. This function can
be used when an application has stored a message identifier or has obtained
one using functions such as LlmFindMessage. Message identifiers are
returned when sending requests using LlmSendMessage or
LlmSendMessageEx.
If message history has been disabled, the library does not retain
previous messages. However, the most recent message and response are
still available and may be retrieved specifying its message identifier.
This also means the data returned in the LLM_MESSAGE and LLM_RESPONSE structures
will only be valid until the next call to LlmSendMessage,
LlmSendMessageEx, or until the session is reset or disconnected.
Applications that need to preserve this information should make a copy of
the data before issuing another request.
If the lpMessage and/or lpResponse parameters are specified,
their respective structures must be initialized with the dwSize
member set to the size of the structure before calling this function. This
enables the library to validate the structure version and maintain
compatibility with future releases.
Either the lpMessage or lpResponse parameter may be NULL if
only one type of information is required. At least one of these parameters
must be specified. If both parameters are NULL, the function fails and sets
the error code to ST_ERROR_INVALID_PARAMETER.
Message identifiers are session-specific and are guaranteed to be
unique only within the client session in which they were created.
Applications must not rely on the internal assignment strategy used to
generate these identifiers. The only guaranteed behavior is that
message identifiers are assigned values which ensure newer messages
always receive larger values than older messages.
If the specified message identifier does not match a message currently
stored in the client history, the function fails. This can occur if the
message has been removed because the history was cleared or trimmed.