locked
What are the valid flag values for IVsTextFind.Find function? RRS feed

  • Question

  • I could not find any documentation relating to the valid flag values for the flags input parameter of the Find function on the IVsTextFind interface.  Does anyone know what values are allowed and what they mean?  The __VSFINDOPTIONS do not seem to be appropriate (using them causes the function to fail).

    Thursday, May 6, 2010 11:18 PM

Answers

  • Hi Jeffrey,

    Error message 0x80004005 means E_FAIL( Unspecified failure), 0x80004001 means E_NOTIMPL (Not implemented). Please see Common HRESULT Values for more information about these error message.

    After discussed with other colleagues,it appears that this parameter is a combination of the TextFindMode values. Please try it, and let me know the result.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Jeffrey Ruff Monday, May 10, 2010 11:42 PM
    Monday, May 10, 2010 2:54 AM

All replies

  • Hi Jeffrey,

    Thanks for your post.

    Yes, there is no detailed documentation relating to the valid flag vaules, I guess the valid flag values are taken from the __VSFINDOPTIONS enumeration, you can pick some values as iflag parameters, such as (int)(_VSFINDOPTIONS.FR_MatchCase+_VSFINDOPTIONS.FR_Selection). please let me know the result.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, May 7, 2010 3:33 AM
  • Text to search in:

    text
    mtext

    constant variables: searchText="Text", startLine=0, startCol=2, endLine=1, endCol=5;

    arguments to Find: (searchText, startLine, startCol, endLine, endCol, flags, out matchLine, out matchCol)

    when flags = (int)__VSFINDOPTIONS.FR_Hidden: return value = 0x80004005, matchLine=2, matchCol=2;

    when flags = (int)__VSFINDOPTIONS.FR_MatchCase: return value = 0x0, matchLine=1, matchCol=1; cases do not match however

    when flags = (int)__VSFINDOPTIONS.FR_MatchWholeWord: return value = 0x80004005, matchLine=2, matchCol=2; similar output when starting at 0,0

    when flags = (int)__VSFINDOPTIONS.FR_SearchBackwards: return value = 0x80004001, matchLine=0, matchCol=0;

    when flags = (int)__VSFINDOPTIONS.FR_SearchSelectionOnly: return value = 0x80004001, matchLine=0, matchCol=0;

    So it is not clear to me what the error codes are complaining about, or whether any of the __VSFINDOPTIONS flags are supported.

    Friday, May 7, 2010 7:54 PM
  • Hi Jeffrey,

    Error message 0x80004005 means E_FAIL( Unspecified failure), 0x80004001 means E_NOTIMPL (Not implemented). Please see Common HRESULT Values for more information about these error message.

    After discussed with other colleagues,it appears that this parameter is a combination of the TextFindMode values. Please try it, and let me know the result.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Jeffrey Ruff Monday, May 10, 2010 11:42 PM
    Monday, May 10, 2010 2:54 AM
  • This seems to work better.

    Using TextFindMode.TFIND_BACKWARDS, TextFindMode.TFIND_MATCH_CASE and TextFindMode.TFIND_WHOLE_WORD are able to complete successfully on a block of text.

    Using TextFindMode.TFIND_REG_EXPR, TextFindMode.TFIND_WRAP_SEARCH, TextFindMode.TFIND_IN_SELECTION, and TextFindMode.TFIND_NEW_SEARCH all result in E_NOTIMPL.

    Monday, May 10, 2010 11:42 PM