共用方式為


IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles Method

Definition

This method notifies the client when a project has requested to rename files.

public:
 int OnQueryRenameFiles(Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, int cFiles, cli::array <System::String ^> ^ rgszMkOldNames, cli::array <System::String ^> ^ rgszMkNewNames, cli::array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILEFLAGS> ^ rgFlags, cli::array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILERESULTS> ^ pSummaryResult, cli::array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILERESULTS> ^ rgResults);
public:
 int OnQueryRenameFiles(Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, int cFiles, Platform::Array <Platform::String ^> ^ rgszMkOldNames, Platform::Array <Platform::String ^> ^ rgszMkNewNames, Platform::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILEFLAGS> ^ rgFlags, Platform::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILERESULTS> ^ pSummaryResult, Platform::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILERESULTS> ^ rgResults);
int OnQueryRenameFiles(Microsoft::VisualStudio::Shell::Interop::IVsProject const & pProject, int cFiles, std::Array <std::wstring const &> const & rgszMkOldNames, std::Array <std::wstring const &> const & rgszMkNewNames, std::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILEFLAGS> const & rgFlags, std::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILERESULTS> const & pSummaryResult, std::Array <Microsoft::VisualStudio::Shell::Interop::VSQUERYRENAMEFILERESULTS> const & rgResults);
public int OnQueryRenameFiles (Microsoft.VisualStudio.Shell.Interop.IVsProject pProject, int cFiles, string[] rgszMkOldNames, string[] rgszMkNewNames, Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILEFLAGS[] rgFlags, Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILERESULTS[] pSummaryResult, Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILERESULTS[] rgResults);
abstract member OnQueryRenameFiles : Microsoft.VisualStudio.Shell.Interop.IVsProject * int * string[] * string[] * Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILEFLAGS[] * Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILERESULTS[] * Microsoft.VisualStudio.Shell.Interop.VSQUERYRENAMEFILERESULTS[] -> int
Public Function OnQueryRenameFiles (pProject As IVsProject, cFiles As Integer, rgszMkOldNames As String(), rgszMkNewNames As String(), rgFlags As VSQUERYRENAMEFILEFLAGS(), pSummaryResult As VSQUERYRENAMEFILERESULTS(), rgResults As VSQUERYRENAMEFILERESULTS()) As Integer

Parameters

pProject
IVsProject

[in] Project requesting to rename files.

cFiles
Int32

[in] Number of files to rename.

rgszMkOldNames
String[]

[in] Array of old file names.

rgszMkNewNames
String[]

[in] Array of new file names.

rgFlags
VSQUERYRENAMEFILEFLAGS[]

[in] Array of flags. For a list of rgFlags values, see VSQUERYRENAMEFILEFLAGS.

pSummaryResult
VSQUERYRENAMEFILERESULTS[]

[out] Summary result object. This object is a summation of the yes and no results for the array of files passed in rgszMkOldNames. If the result for a single file is no, then pSummaryResult is equal to VSQUERYRENAMEFILERESULTS_RenameNotOK; if the results for all files are yes, then pSummaryResult is equal to VSQUERYRENAMEFILERESULTS_RenameOK. For a list of pSummaryResult values, see VSQUERYRENAMEFILERESULTS.

rgResults
VSQUERYRENAMEFILERESULTS[]

[out] Array of results. For a list of rgResults values, see VSQUERYRENAMEFILERESULTS.

Returns

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

Remarks

COM Signature

From IVsTrackProjectDocumentsEvents2.idl

HRESULT IVsTrackProjectDocumentsEvents2::OnQueryRenameFiles(  
   [in] IVsProject *pProject,  
   [in] int cFiles, [in, size_is(cFiles)] const LPCOLESTR rgszMkOldNames[],  
   [in, size_is(cFiles)] const LPCOLESTR rgszMkNewNames[],  
   [in, size_is(cFiles)] const VSQUERYRENAMEFILEFLAGS rgflags[],  
   [out] VSQUERYRENAMEFILERESULTS *pSummaryResult,  
   [out, size_is(cFiles)] VSQUERYRENAMEFILERESULTS rgResults[]  
);  

Use IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles to indicate whether specified files can be renamed in the project. Only deny a query if allowing the operation would compromise your stable state. For example, source control denies rename queries if the new name conflicts with an existing file already under source control.

Applies to