共用方式為


IVsSolution.GetProjrefOfItem(IVsHierarchy, UInt32, String) Method

Definition

Returns a project reference string for the specified hierarchy and hierarchy item pair.

public:
 int GetProjrefOfItem(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHierarchy, System::UInt32 itemid, [Runtime::InteropServices::Out] System::String ^ % pbstrProjref);
int GetProjrefOfItem(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHierarchy, unsigned int itemid, [Runtime::InteropServices::Out] std::wstring const & & pbstrProjref);
public int GetProjrefOfItem (Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHierarchy, uint itemid, out string pbstrProjref);
abstract member GetProjrefOfItem : Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * string -> int
Public Function GetProjrefOfItem (pHierarchy As IVsHierarchy, itemid As UInteger, ByRef pbstrProjref As String) As Integer

Parameters

pHierarchy
IVsHierarchy

[in] Pointer to the IVsHierarchy interface.

itemid
UInt32

[in] Valid item identifier within the project; not a VSITEMID value.

pbstrProjref
String

[out] Pointer to the project reference string.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsSolution::GetProjrefOfItem(  
   [in] IVsHierarchy *pHierarchy,  
   [in] VSITEMID itemid,  
   [out] BSTR *pbstrProjref  
);  

The following is a description of how the GetProjrefOfItem method is used to support drag-and-drop operations:

The CF_VSPROJECTITEMS and CF_VSPROJECTS clipboard formats use the DROPFILES structure in the same manner as CF_HDROP or CF_PRINTERS. The data that follows the DROPFILES structure is a double-NULL-terminated list of Projref strings. The consumer of the drop operation can use the Windows API DragQueryFile to examine the data in the DROPFILES structure. CF_VSPROJECTS format is offered when the Projref strings identify projects as a whole, that is, *pitemid == VSITEMID_ROOT. The CF_VSPROJECTITEMS format is offered when the Projref strings identify one or more individual project items. Either CF_VSPROJECTS or CF_VSPROJECTITEMS should be offered, but never both.

Applies to