I have the following code. It's supposed to get the current selection in a rich edit box and then find the text "PROC" from the beginning of the edit box to the current selection. ProcWord db "PROC", 0 StatusBarProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM LOCAL CharRange:CHARRANGE, fte:FINDTEXTEX .IF uMsg == WM_COMMAND .IF wParam == BN_CLICKED mov eax, lParam .IF eax == hProcOnly invoke SendMessage, hWndEdit, EM_EXGETSEL, 0, ADDR CharRange mov eax, CharRange.cpMin mov fte.chrg.cpMax, eax mov fte.chrg.cpMin, 1 mov fte.lpstrText, OFFSET ProcWord invoke SendMessage, hWndEdit, EM_FINDTEXTEX, FR_WHOLEWORD, ADDR fte I debugged this code with Windbg and it properly gets the location of the current selection. I also made sure that the word "PROC" occured both before and after the selection multiple times. Yet, when it tries to find the text, it returns -1. Does anyone ahve any clue what is wrong with the code?
Posted on 2000-12-03 13:57:00 by Hel
i've made a prog using richedit source is at scalper.cjb.net/sPad.htm and exe(with source) at scalper.cjb.net/sPad/
Posted on 2000-12-04 10:03:00 by (scalp)
If your using RichEdit v3 you will have to 'or' FR_DOWN in your flag field, it might be the same with v2. Ewayne
Posted on 2000-12-04 17:07:00 by Ewayne
if your using RichEdit v3 you will have to 'or' FR_DOWN into the flag field, it might be the same for v2. Ewayne
Posted on 2000-12-04 17:08:00 by Ewayne
if your using RichEdit v3 you will have to 'or' FR_DOWN into the flag field, it might be the same for v2. Ewayne
Posted on 2000-12-04 17:08:00 by Ewayne
I knew there was something I forgot to mention: I tried it with and without FR_DOWN and both ways, it failed.
Posted on 2000-12-04 23:01:00 by Hel
What Windows.inc are you using? There was a problem with an earlier Windows.inc. You might try it with the FINDTEXT structure and EM_FINDTEXT message. There is nothing wrong with your code if you are getting the proper selection and there is not a character next to "PROC", if there is then FR_WHOLEWORD will not work. Ewayne
Posted on 2000-12-05 01:20:00 by Ewayne