共用方式為


IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles Method

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

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'宣告
Function OnQueryRenameFiles ( _
    pProject As IVsProject, _
    cFiles As Integer, _
    rgszMkOldNames As String(), _
    rgszMkNewNames As String(), _
    rgFlags As VSQUERYRENAMEFILEFLAGS(), _
    <OutAttribute> pSummaryResult As VSQUERYRENAMEFILERESULTS(), _
    <OutAttribute> rgResults As VSQUERYRENAMEFILERESULTS() _
) As Integer
'用途
Dim instance As IVsTrackProjectDocumentsEvents2
Dim pProject As IVsProject
Dim cFiles As Integer
Dim rgszMkOldNames As String()
Dim rgszMkNewNames As String()
Dim rgFlags As VSQUERYRENAMEFILEFLAGS()
Dim pSummaryResult As VSQUERYRENAMEFILERESULTS()
Dim rgResults As VSQUERYRENAMEFILERESULTS()
Dim returnValue As Integer

returnValue = instance.OnQueryRenameFiles(pProject, _
    cFiles, rgszMkOldNames, rgszMkNewNames, _
    rgFlags, pSummaryResult, rgResults)
int OnQueryRenameFiles(
    IVsProject pProject,
    int cFiles,
    string[] rgszMkOldNames,
    string[] rgszMkNewNames,
    VSQUERYRENAMEFILEFLAGS[] rgFlags,
    VSQUERYRENAMEFILERESULTS[] pSummaryResult,
    VSQUERYRENAMEFILERESULTS[] rgResults
)
int OnQueryRenameFiles(
    [InAttribute] IVsProject^ pProject, 
    [InAttribute] int cFiles, 
    [InAttribute] array<String^>^ rgszMkOldNames, 
    [InAttribute] array<String^>^ rgszMkNewNames, 
    [InAttribute] array<VSQUERYRENAMEFILEFLAGS>^ rgFlags, 
    [OutAttribute] array<VSQUERYRENAMEFILERESULTS>^ pSummaryResult, 
    [OutAttribute] array<VSQUERYRENAMEFILERESULTS>^ rgResults
)
abstract OnQueryRenameFiles : 
        pProject:IVsProject * 
        cFiles:int * 
        rgszMkOldNames:string[] * 
        rgszMkNewNames:string[] * 
        rgFlags:VSQUERYRENAMEFILEFLAGS[] * 
        pSummaryResult:VSQUERYRENAMEFILERESULTS[] byref * 
        rgResults:VSQUERYRENAMEFILERESULTS[] byref -> int 
function OnQueryRenameFiles(
    pProject : IVsProject, 
    cFiles : int, 
    rgszMkOldNames : String[], 
    rgszMkNewNames : String[], 
    rgFlags : VSQUERYRENAMEFILEFLAGS[], 
    pSummaryResult : VSQUERYRENAMEFILERESULTS[], 
    rgResults : VSQUERYRENAMEFILERESULTS[]
) : int

Parameters

  • rgszMkOldNames
    Type: array<System.String[]
    [in] Array of old file names.
  • rgszMkNewNames
    Type: array<System.String[]
    [in] Array of new file names.

Return Value

Type: System.Int32
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.

.NET Framework Security

See Also

Reference

IVsTrackProjectDocumentsEvents2 Interface

IVsTrackProjectDocumentsEvents2 Members

Microsoft.VisualStudio.Shell.Interop Namespace