-
Em_findtext
Code:
FINDTEXT ft;
CHARRANGE cr;
DWORD status = -1;
cr.cpMin = 0;
cr.cpMax = -1;
ft.chrg = cr;
ft.lpstrText = find; // find is a string that is declared,defined before ( it doesn't matter much
status = (DWORD)SendMessage(wRichEdit, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&ft);
In the above code, there seems to be a problem : althought i specified FR_DOWN, when
this message is sent, my rich edit doesn't search for the text down, it search up (from the
cursor position)
Only if searching for the string up doesn't sucssed then, rich edit searches down.
MSDN clearly said that if i specify FR_DOWN, the search will go down.
Why isn't it working like this???
-
very strange behaviour, can i find an example of FR_DOWN somewhere?:)
-
here's my code:
Code:
FINDTEXT ft;
CHARRANGE cr;
DWORD status = -1;
cr.cpMin = 0;
cr.cpMax = -1;
ft.chrg = cr;
ft.lpstrText = find;
status = (DWORD)SendMessage(children.eBook, EM_FINDTEXT, (WPARAM)FR_DOWN, (LPARAM)&ft);
-
It is searching down, it is just that you are searching the entire document. The FINDTEXT.chrg parameter specifies the range of characters to search. If you want to search from the current caret, you should retrieve it using EM_GETSEL and use it.
-