共用方式為


IVsProject3.TransferItem(String, String, IVsWindowFrame) Method

Definition

Transfers an item from one project to another. The project that presently owns the item to be transferred calls this method on the project intending to receive the transferred item.

public:
 int TransferItem(System::String ^ pszMkDocumentOld, System::String ^ pszMkDocumentNew, Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ punkWindowFrame);
public:
 int TransferItem(Platform::String ^ pszMkDocumentOld, Platform::String ^ pszMkDocumentNew, Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame ^ punkWindowFrame);
int TransferItem(std::wstring const & pszMkDocumentOld, std::wstring const & pszMkDocumentNew, Microsoft::VisualStudio::Shell::Interop::IVsWindowFrame const & punkWindowFrame);
public int TransferItem (string pszMkDocumentOld, string pszMkDocumentNew, Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame punkWindowFrame);
abstract member TransferItem : string * string * Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame -> int
Public Function TransferItem (pszMkDocumentOld As String, pszMkDocumentNew As String, punkWindowFrame As IVsWindowFrame) As Integer

Parameters

pszMkDocumentOld
String

[in] Path to the old document. Passed as pszDocumentOld to RenameDocument(String, String, IntPtr, UInt32).

pszMkDocumentNew
String

[in] Path to the new document. Passed as pszDocumentNew to RenameDocument(String, String, IntPtr, UInt32).

punkWindowFrame
IVsWindowFrame

[in] Optional. Pointer to the IVsWindowFrame interface.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsProject3::TransferItem(  
   [in] LPCOLESTR pszMkDocumentOld,  
   [in] LPCOLESTR pszMkDocumentNew,  
   [in] IVsWindowFrame *punkWindowFrame  
);  

This method is used to transfer ownership of a running document to the project. The project should call RenameDocument to transfer ownership of the document to its hierarchy and give the document a new itemid within the project.

This method is called when an open file is being transferred to your project. The sequence is for the environment to call AddItemWithSpecific and then use TransferItem to transfer the open document to your project.

Both projects must be open to transfer an item from one to the other. The implementer of the transfer must call RenameDocument to rename the item.

Applies to