Em_findtext

This is a discussion on Em_findtext within the Windows Programming forums, part of the Platform Specific Boards category; Code: FINDTEXT ft; CHARRANGE cr; DWORD status = -1; cr.cpMin = 0; cr.cpMax = -1; ft.chrg = cr; ft.lpstrText = ...

  1. #1
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377

    Question 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???
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  2. #2
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    very strange behaviour, can i find an example of FR_DOWN somewhere?
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  3. #3
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    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);
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    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.

  5. #5
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    aha, thanks.
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21