Aldo,

Here is another useful function for a RichEdit control:

    ###########################################################################
    # (@)METHOD:GetTextRange(START, LENGTH)
    # Returns LENGTH bytes of text from the RichEdit control, starting at START
void
GetTextRange(handle,start,length)
    HWND handle
    LONG start
    LONG length
PREINIT:
    TEXTRANGE tr;
    CHARRANGE cr;
    char * text;
    LRESULT count;
PPCODE:
    ZeroMemory(&tr, sizeof(TEXTRANGE));
    ZeroMemory(&cr, sizeof(CHARRANGE));
    if(length < 0) length = 0;
    if(start < 0) start = 0;
    text = (char *) safemalloc(length+1);
    cr.cpMin = start;
    cr.cpMax = start+length;
    tr.chrg = cr;
    tr.lpstrText = text;
    count = SendMessage(handle, EM_GETTEXTRANGE, 0, (LPARAM) (TEXTRANGE FAR *) 
&tr);
    EXTEND(SP, 1);
    XST_mPV(0, text);
    safefree(text);
    XSRETURN(1);


Trevor S Garside
[EMAIL PROTECTED]


Reply via email to