Partager via


IVsTrackProjectDocuments2.OnQueryRenameFile Method

This method is called by a project to determine whether a file in the project can be renamed.

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

Syntax

'Déclaration
Function OnQueryRenameFile ( _
    pProject As IVsProject, _
    pszMkOldName As String, _
    pszMkNewName As String, _
    flags As VSRENAMEFILEFLAGS, _
    <OutAttribute> ByRef pfRenameCanContinue As Integer _
) As Integer
'Utilisation
Dim instance As IVsTrackProjectDocuments2
Dim pProject As IVsProject
Dim pszMkOldName As String
Dim pszMkNewName As String
Dim flags As VSRENAMEFILEFLAGS
Dim pfRenameCanContinue As Integer
Dim returnValue As Integer

returnValue = instance.OnQueryRenameFile(pProject, _
    pszMkOldName, pszMkNewName, flags, _
    pfRenameCanContinue)
int OnQueryRenameFile(
    IVsProject pProject,
    string pszMkOldName,
    string pszMkNewName,
    VSRENAMEFILEFLAGS flags,
    out int pfRenameCanContinue
)
int OnQueryRenameFile(
    [InAttribute] IVsProject^ pProject, 
    [InAttribute] String^ pszMkOldName, 
    [InAttribute] String^ pszMkNewName, 
    [InAttribute] VSRENAMEFILEFLAGS flags, 
    [OutAttribute] int% pfRenameCanContinue
)
function OnQueryRenameFile(
    pProject : IVsProject, 
    pszMkOldName : String, 
    pszMkNewName : String, 
    flags : VSRENAMEFILEFLAGS, 
    pfRenameCanContinue : int
) : int

Parameters

  • pszMkOldName
    Type: System.String

    [in] Path to the old file name.

  • pszMkNewName
    Type: System.String

    [in] Path to the new file name.

  • pfRenameCanContinue
    Type: System.Int32%

    [out] This value is true if file renaming can continue.

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 IVsTrackProjectDocuments2.idl

HRESULT IVsTrackProjectDocuments2::OnQueryRenameFile(
   [in] IVsProject *pProject,
   [in] LPCOLESTR pszMkOldName,
   [in] LPCOLESTR pszMkNewName,
   [in] VSRENAMEFILEFLAGS flags,
   [out] BOOL *pfRenameCanContinue
);

Call this method when you want to rename a file in the project. This method must be called before the file is renamed in the project. The environment returns a flag indicating whether the file can be renamed. After you have received authorization to rename the file and you have renamed it, call OnAfterRenameFile to confirm that the file has been renamed and to provide the environment with the new name.

Permissions

See Also

Reference

IVsTrackProjectDocuments2 Interface

IVsTrackProjectDocuments2 Members

Microsoft.VisualStudio.Shell.Interop Namespace