Condividi tramite


IVsProject3.GenerateUniqueItemName Method (UInt32, String, String, String%)

Generates a unique document name for a given item.

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

Syntax

'Dichiarazione
Function GenerateUniqueItemName ( _
    itemidLoc As UInteger, _
    pszExt As String, _
    pszSuggestedRoot As String, _
    <OutAttribute> ByRef pbstrItemName As String _
) As Integer
'Utilizzo
Dim instance As IVsProject3
Dim itemidLoc As UInteger
Dim pszExt As String
Dim pszSuggestedRoot As String
Dim pbstrItemName As String
Dim returnValue As Integer

returnValue = instance.GenerateUniqueItemName(itemidLoc, _
    pszExt, pszSuggestedRoot, pbstrItemName)
int GenerateUniqueItemName(
    uint itemidLoc,
    string pszExt,
    string pszSuggestedRoot,
    out string pbstrItemName
)
int GenerateUniqueItemName(
    [InAttribute] unsigned int itemidLoc, 
    [InAttribute] String^ pszExt, 
    [InAttribute] String^ pszSuggestedRoot, 
    [OutAttribute] String^% pbstrItemName
)
abstract GenerateUniqueItemName : 
        itemidLoc:uint32 * 
        pszExt:string * 
        pszSuggestedRoot:string * 
        pbstrItemName:string byref -> int 
function GenerateUniqueItemName(
    itemidLoc : uint, 
    pszExt : String, 
    pszSuggestedRoot : String, 
    pbstrItemName : String
) : int

Parameters

  • itemidLoc
    Type: System.UInt32
    [in] Container folder for the unique item name being generated. Should be a valid item identifier. For further information, see VSITEMID. The value of this parameter is typically determined by the itemidLoc parameter that the project passes to the AddProjectItemDlg method.
  • pszExt
    Type: System.String
    [in] File extension of the new document name.
  • pszSuggestedRoot
    Type: System.String
    [in] If not nulla null reference (Nothing in Visual Basic) or empty, this value should be used as the base name for the item, and numbers should be appended to make the name unique. If supplied, the project should make up its own root name based on the pszExt file extension.
  • pbstrItemName
    Type: System.String%
    [out] Pointer to the new name, which contains the name only, not the item's file path.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

IVsProject2.GenerateUniqueItemName(UInt32, String, String, String%)

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsProject3::GenerateUniqueItemName(
   [in] VSITEMID itemidLoc,
   [in] LPCOLESTR pszExt,
   [in] LPCOLESTR pszSuggestedRoot,
   [out] BSTR * pbstrItemName
);

The Add Item dialog box uses this method to suggest a name for the user when a new item is selected.

.NET Framework Security

See Also

Reference

IVsProject3 Interface

IVsProject3 Members

GenerateUniqueItemName Overload

Microsoft.VisualStudio.Shell.Interop Namespace