共用方式為


IVsAddProjectItemDlg2.AddProjectItemDlgTitledEx Method

Provides additional functionality to the AddProjectItemDlgTitled method such as treeview, help, and default directory selection and expansion.

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

Syntax

'宣告
Function AddProjectItemDlgTitledEx ( _
    itemidLoc As UInteger, _
    ByRef rguidProject As Guid, _
    pProject As IVsProject, _
    grfAddFlags As UInteger, _
    lpszDlgTitle As String, _
    lpszTreeViewTitle As String, _
    lpszHelpTopic As String, _
    lpszExpand As String, _
    lpszSelect As String, _
    <OutAttribute> ByRef pbstrLocation As String, _
    <OutAttribute> ByRef pbstrFilter As String, _
    <OutAttribute> ByRef pfDontShowAgain As Integer _
) As Integer
'用途
Dim instance As IVsAddProjectItemDlg2
Dim itemidLoc As UInteger
Dim rguidProject As Guid
Dim pProject As IVsProject
Dim grfAddFlags As UInteger
Dim lpszDlgTitle As String
Dim lpszTreeViewTitle As String
Dim lpszHelpTopic As String
Dim lpszExpand As String
Dim lpszSelect As String
Dim pbstrLocation As String
Dim pbstrFilter As String
Dim pfDontShowAgain As Integer
Dim returnValue As Integer

returnValue = instance.AddProjectItemDlgTitledEx(itemidLoc, _
    rguidProject, pProject, grfAddFlags, _
    lpszDlgTitle, lpszTreeViewTitle, _
    lpszHelpTopic, lpszExpand, lpszSelect, _
    pbstrLocation, pbstrFilter, pfDontShowAgain)
int AddProjectItemDlgTitledEx(
    uint itemidLoc,
    ref Guid rguidProject,
    IVsProject pProject,
    uint grfAddFlags,
    string lpszDlgTitle,
    string lpszTreeViewTitle,
    string lpszHelpTopic,
    string lpszExpand,
    string lpszSelect,
    out string pbstrLocation,
    out string pbstrFilter,
    out int pfDontShowAgain
)
int AddProjectItemDlgTitledEx(
    [InAttribute] unsigned int itemidLoc, 
    [InAttribute] Guid% rguidProject, 
    [InAttribute] IVsProject^ pProject, 
    [InAttribute] unsigned int grfAddFlags, 
    [InAttribute] String^ lpszDlgTitle, 
    [InAttribute] String^ lpszTreeViewTitle, 
    [InAttribute] String^ lpszHelpTopic, 
    [InAttribute] String^ lpszExpand, 
    [InAttribute] String^ lpszSelect, 
    [InAttribute] [OutAttribute] String^% pbstrLocation, 
    [InAttribute] [OutAttribute] String^% pbstrFilter, 
    [OutAttribute] int% pfDontShowAgain
)
abstract AddProjectItemDlgTitledEx : 
        itemidLoc:uint32 * 
        rguidProject:Guid byref * 
        pProject:IVsProject * 
        grfAddFlags:uint32 * 
        lpszDlgTitle:string * 
        lpszTreeViewTitle:string * 
        lpszHelpTopic:string * 
        lpszExpand:string * 
        lpszSelect:string * 
        pbstrLocation:string byref * 
        pbstrFilter:string byref * 
        pfDontShowAgain:int byref -> int 
function AddProjectItemDlgTitledEx(
    itemidLoc : uint, 
    rguidProject : Guid, 
    pProject : IVsProject, 
    grfAddFlags : uint, 
    lpszDlgTitle : String, 
    lpszTreeViewTitle : String, 
    lpszHelpTopic : String, 
    lpszExpand : String, 
    lpszSelect : String, 
    pbstrLocation : String, 
    pbstrFilter : String, 
    pfDontShowAgain : int
) : int

Parameters

  • itemidLoc
    Type: System.UInt32
    [in] Item identifier of the folder in the project to which items should be added. This is useful only for directory-based projects. Non-directory-based projects pass VSITEMID_ROOT. The Add Item dialog box does not use the parameter except to pass it back to AddItem.
  • rguidProject
    Type: System.Guid%
    [in] Identifier for the project type. This identifier should be registered under the Projects subkey of the Microsoft Visual Studio registry key. The dialog box uses the following information under that key:
    • ItemTemplateDir value, which should contain the path to the directory containing item templates for this project type.

    • Filters key, which is used to construct open filters for the Existing tab.

    • The dialog box displays items and filters specific to this project type.

  • grfAddFlags
    Type: System.UInt32
    [in] Flag values that modify the behavior of the dialog box. Values are taken from the __VSADDITEMFLAGS enumeration.
  • lpszTreeViewTitle
    Type: System.String
    [in] Treeview caption. nulla null reference (Nothing in Visual Basic) == "Categories".
  • lpszHelpTopic
    Type: System.String
    [in] The name of the Help topic. nulla null reference (Nothing in Visual Basic) == "vs.add[new|existing] item.".
  • lpszExpand
    Type: System.String
    [in] The directory to select or expand by default.
  • pbstrLocation
    Type: System.String%
    [in, out] Pointer to the location field (initial/final value). This parameter is used only if you specify a value of VSADDITEM_ShowLocationField. To have the project implement sticky behavior, which is the recommended behavior, for the location field, pass the last location field value back in when you open the dialog box again.
  • pbstrFilter
    Type: System.String%
    [in, out] Value of the filter string on the Existing tab. Specify a value of VSADDITEM_AllowStickyFilter instead of VSADDITEM_AllowStickyFilter is set. To have the project implement a sticky behavior for the filter field, which is the recommended behavior, pass the last filter field value back in when you open the dialog box again.
  • pfDontShowAgain
    Type: System.Int32%
    [out] Indicator of whether the user selected or cleared the Don't Show This Dialog Again option. This parameter is used only if you specify VSADDITEM_ShowDontShowAgain. To implement the option, which is the recommended behavior, call directly the last selected item template's AddItem method. Typically, a project maintains a separate Don't Show Again option for each item type, such as Form, Module, and Class.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsAddProjectItemDlg2::AddProjectItemDlgTitledEx(
   [in] VSITEMID itemidLoc,
   [in] REFGUID rguidProject,
   [in] IVsProject *pProject,
   [in] VSADDITEMFLAGS grfAddFlags,
   [in] LPCOLESTR lpszDlgTitle,
   [in] LPCOLESTR lpszTreeViewTitle,
   [in] LPCOLESTR lpszHelpTopic,
   [in] LPCOLESTR lpszExpand,
   [in] LPCOLESTR lpszSelect,
   [in, out] BSTR *pbstrLocation,
   [in, out] BSTR *pbstrFilter,
   [out] BOOL *pfDontShowAgain
);

.NET Framework Security

See Also

Reference

IVsAddProjectItemDlg2 Interface

IVsAddProjectItemDlg2 Members

Microsoft.VisualStudio.Shell.Interop Namespace