共用方式為


IVsFindTarget.Replace Method

Definition

Requests a text string replace.

public:
 int Replace(System::String ^ pszSearch, System::String ^ pszReplace, System::UInt32 grfOptions, int fResetStartPoint, Microsoft::VisualStudio::TextManager::Interop::IVsFindHelper ^ pHelper, [Runtime::InteropServices::Out] int % pfReplaced);
int Replace(std::wstring const & pszSearch, std::wstring const & pszReplace, unsigned int grfOptions, int fResetStartPoint, Microsoft::VisualStudio::TextManager::Interop::IVsFindHelper const & pHelper, [Runtime::InteropServices::Out] int & pfReplaced);
public int Replace (string pszSearch, string pszReplace, uint grfOptions, int fResetStartPoint, Microsoft.VisualStudio.TextManager.Interop.IVsFindHelper pHelper, out int pfReplaced);
abstract member Replace : string * string * uint32 * int * Microsoft.VisualStudio.TextManager.Interop.IVsFindHelper * int -> int
Public Function Replace (pszSearch As String, pszReplace As String, grfOptions As UInteger, fResetStartPoint As Integer, pHelper As IVsFindHelper, ByRef pfReplaced As Integer) As Integer

Parameters

pszSearch
String

[in] Pointer to a null terminated string containing the search text.

pszReplace
String

[in] Pointer to a null terminated string containing the replacement text.

grfOptions
UInt32

[in] Specifies the search options. Values are taken from the __VSFINDOPTIONS enumeration.

fResetStartPoint
Int32

[in] Flag to reset the search start point.

pHelper
IVsFindHelper

[in] Pointer to a IVsFindHelper interface.

pfReplaced
Int32

[out, retval] true if the replacement was successful.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

Implement either GetSearchImage method or Find and Replace methods.

COM Signature

From textmgr.idl:

HRESULT IVsFindTarget::Replace(  
   [in] LPCOLESTR pszSearch,  
   [in] LPCOLESTR pszReplace,  
   [in] VSFINDOPTIONS grfOptions,  
   [in] BOOL fResetStartPoint,  
   [in] IVsFindHelper * pHelper  
);  

Find is called prior to Replace. When Replace is called, you should verify that the current selection string is equal to pszSearch, then replace the selection with pszReplace.

Applies to