共用方式為


IVsTrackProjectDocuments2.OnQueryRenameFile Method

Definition

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

public:
 int OnQueryRenameFile(Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, System::String ^ pszMkOldName, System::String ^ pszMkNewName, Microsoft::VisualStudio::Shell::Interop::VSRENAMEFILEFLAGS flags, [Runtime::InteropServices::Out] int % pfRenameCanContinue);
int OnQueryRenameFile(Microsoft::VisualStudio::Shell::Interop::IVsProject const & pProject, std::wstring const & pszMkOldName, std::wstring const & pszMkNewName, Microsoft::VisualStudio::Shell::Interop::VSRENAMEFILEFLAGS flags, [Runtime::InteropServices::Out] int & pfRenameCanContinue);
public int OnQueryRenameFile (Microsoft.VisualStudio.Shell.Interop.IVsProject pProject, string pszMkOldName, string pszMkNewName, Microsoft.VisualStudio.Shell.Interop.VSRENAMEFILEFLAGS flags, out int pfRenameCanContinue);
abstract member OnQueryRenameFile : Microsoft.VisualStudio.Shell.Interop.IVsProject * string * string * Microsoft.VisualStudio.Shell.Interop.VSRENAMEFILEFLAGS * int -> int
Public Function OnQueryRenameFile (pProject As IVsProject, pszMkOldName As String, pszMkNewName As String, flags As VSRENAMEFILEFLAGS, ByRef pfRenameCanContinue As Integer) As Integer

Parameters

pProject
IVsProject

[in] Project containing the file to be renamed.

pszMkOldName
String

[in] Path to the old file name.

pszMkNewName
String

[in] Path to the new file name.

flags
VSRENAMEFILEFLAGS

[in] For a list of flags values, see VSRENAMEFILEFLAGS.

pfRenameCanContinue
Int32

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

Returns

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.

Applies to