Ok, I am new to windows so help me out on this one; I want to get the text thats highlighted and send it to an internal manipulator and then replace the highlighted section with the manipulated string.
I haven't done Windows programming without a framework in over 15 years, so don't try to compile this, but I'd imagine the code would go something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{
// Get selection range
DWORD dwBegin. dwEnd;
SendMessage(hEdit, EM_GETSEL, (WPARAM)&dwBegin, (LPARAM)&dwEnd);
// Get text
int iMaxTextLen = 4096; // some number
char* pszText = newchar[iMaxTextLen];
SendMessage(hEdit, WM_GETTEXT, (WPARAM)iMaxTextLen, (LPARAM)pszText);
std::string sOldString(pszText + dwBegin, dwEnd - dwBegin);
std::string sNewString = DetermineNewString(sOldString); // apply your change
delete [] pszText, pszText = 0;
// Replace text
DWORD dwCanUndo = 1;
SendMessage(hEdit, EM_REPLACESEL, (WPARAM)dwCanUndo, (LPARAM)sNewString.c_str());
}