• Hi!
    I'm noob in plugin development, and i have little question:
    I want to get all text and convert it by specific algorytm, how can i do this using SendMessage?


      I prefer my macro to using SendMessage directly because of the hassle and danger of improper casting.

      #define SENDMSGTOCED(which,mesg,wpm,lpm) SendMessage(((which)?g_nppData._scintillaSecondHandle:g_nppData._scintillaMainHandle),mesg,(WPARAM)(wpm),(LPARAM)(lpm))
      int currentEdit;
      SendMessage(g_nppData._nppHandle, WM_GETCURRENTSCINTILLA, 0, (LPARAM)&currentEdit);

      size_t uTextSize=SENDMSGTOCED(currentEdit, SCI_GETLENGTH, 0, 0)+1;
      if (uTextSize<=1) return;
      char *tx=malloc(uTextSize);if (!tx) return;
      size_t uTextLen=SENDMSGTOCED(currentEdit, SCI_GETTEXT   , uTextSize, tx);

      Your next question is how to put the text back into the document.

      SENDMSGTOCED(currentEdit,SCI_SETTEXT,0, tx);

      SCI_SETTEXT can't handle text with nulls in it. Look at the plugin sources to see more detail.