IVsProject2.GenerateUniqueItemName(UInt32, String, String, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为给定项生成唯一的文档名称。
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
参数
- itemidLoc
- UInt32
中正在生成唯一项名称的容器文件夹。 应为有效的项标识符。 有关详细信息,请参阅 VSITEMID 。 此参数的值通常由 itemidLoc 项目传递给方法的参数决定 AddProjectItemDlg(UInt32, Guid, IVsProject, UInt32, String, String, String, String, Int32) 。
- pszExt
- String
中新文档名称的文件扩展名。
- pszSuggestedRoot
- String
中如果不为 null 或空,则应将此值用作项的基名称,并且应追加数字以使名称唯一。 如果提供,则该项目应基于文件扩展名创建自己的根名称 pszExt 。
- pbstrItemName
- String
弄指向新名称的指针,该名称只包含名称,而不包含项的文件路径。
返回
如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。
实现
注解
COM 签名
从 vsshell:
HRESULT IVsProject2::GenerateUniqueItemName(
[in] VSITEMID itemidLoc,
[in] LPCOLESTR pszExt,
[in] LPCOLESTR pszSuggestedRoot,
[out] BSTR * pbstrItemName
);
" 添加项 " 对话框使用此方法在选择新项时为用户提供名称建议。