Using the messenger api you can use the IMessengerConvosationWnd interface of a convosation window do get its contents.
code:
oConversationwindow.history
oCovosation window is the IMessengerConvosationWnd interface of the window you want to get the history of