I am a beginner so probably this is a simple problem...but I wasn't able to figure out how to do it :
How can I loop through all opened documents (tabs) and get the text for each document?
I already have some code that loops though all documents\tabs and gets the filename for each document, this is done using NPPM_GETNBOPENFILES, NPPM_GETBUFFERIDFROMPOS and NPPM_GETFULLPATHFROMBUFFERID.
But with these messages I only get the document names - but not their text.
For the active document\tab I can get the text with SCI_GETTEXT - but how could I loop through all opened documents and get each document's text?
You basically need to do the document handle dance. What this means is capturing the document handle for each tab (when you get a FILEOPENED, or BUFFERACTIVATED, grab a copy of the document pointer - SCI_GETDOCPOINTER).
Then you can create a hidden Scintilla control (NPPM_CREATESCINTILLAHANDLE), and set the doc pointer to each doc pointer you captured (SCI_SETDOCPOINTER). Then you can call SCI_GETTEXT on your hidden scintilla. It's more efficient to keep the Scintilla around whilst you still might need it, and only destroy it with NPPM_DESTROYSCINTILLAHANDLE on NPPN_SHUTDOWN.
Hope that helps.