IVsProject2::GenerateUniqueItemName Method (UInt32, String^, String^, String^)
Generates a unique document name for a given item.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int GenerateUniqueItemName( unsigned int itemidLoc, String^ pszExt, String^ pszSuggestedRoot, [OutAttribute] String^% pbstrItemName )
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 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
-
Type:
System::String^
[out] Pointer to the new name, which contains the name only, not the item's file path.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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.