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

Definition

Generates a unique document name for a given item.

public:
 int GenerateUniqueItemName(System::UInt32 itemidLoc, System::String ^ pszExt, System::String ^ pszSuggestedRoot, [Runtime::InteropServices::Out] System::String ^ % pbstrItemName);
int GenerateUniqueItemName(unsigned int itemidLoc, std::wstring const & pszExt, std::wstring const & pszSuggestedRoot, [Runtime::InteropServices::Out] std::wstring const & & pbstrItemName);
public int GenerateUniqueItemName (uint itemidLoc, string pszExt, string pszSuggestedRoot, out string pbstrItemName);
abstract member GenerateUniqueItemName : uint32 * string * string * string -> int
Public Function GenerateUniqueItemName (itemidLoc As UInteger, pszExt As String, pszSuggestedRoot As String, ByRef pbstrItemName As String) As Integer

Parameters

itemidLoc
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(UInt32, Guid, IVsProject, UInt32, String, String, String, String, Int32) method.

pszExt
String

[in] File extension of the new document name.

pszSuggestedRoot
String

[in] If not null 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
String

[out] Pointer to the new name, which contains the name only, not the item's file path.

Returns

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

Implements

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsProject2::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.

Applies to