IVsAddProjectItemDlg2.AddProjectItemDlg Method (UInt32, Guid%, IVsProject, UInt32, String, String, String%, String%, Int32%)
Displays the Add Item dialog box on behalf of the calling project.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaration
Function AddProjectItemDlg ( _
itemidLoc As UInteger, _
ByRef rguidProject As Guid, _
pProject As IVsProject, _
grfAddFlags As UInteger, _
lpszExpand As String, _
lpszSelect As String, _
<OutAttribute> ByRef pbstrLocation As String, _
<OutAttribute> ByRef pbstrFilter As String, _
<OutAttribute> ByRef pfDontShowAgain As Integer _
) As Integer
'Usage
Dim instance As IVsAddProjectItemDlg2
Dim itemidLoc As UInteger
Dim rguidProject As Guid
Dim pProject As IVsProject
Dim grfAddFlags As UInteger
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.AddProjectItemDlg(itemidLoc, _
rguidProject, pProject, grfAddFlags, _
lpszExpand, lpszSelect, pbstrLocation, _
pbstrFilter, pfDontShowAgain)
int AddProjectItemDlg(
uint itemidLoc,
ref Guid rguidProject,
IVsProject pProject,
uint grfAddFlags,
string lpszExpand,
string lpszSelect,
out string pbstrLocation,
out string pbstrFilter,
out int pfDontShowAgain
)
int AddProjectItemDlg(
[InAttribute] unsigned int itemidLoc,
[InAttribute] Guid% rguidProject,
[InAttribute] IVsProject^ pProject,
[InAttribute] unsigned int grfAddFlags,
[InAttribute] String^ lpszExpand,
[InAttribute] String^ lpszSelect,
[InAttribute] [OutAttribute] String^% pbstrLocation,
[InAttribute] [OutAttribute] String^% pbstrFilter,
[OutAttribute] int% pfDontShowAgain
)
abstract AddProjectItemDlg :
itemidLoc:uint32 *
rguidProject:Guid byref *
pProject:IVsProject *
grfAddFlags:uint32 *
lpszExpand:string *
lpszSelect:string *
pbstrLocation:string byref *
pbstrFilter:string byref *
pfDontShowAgain:int byref -> int
function AddProjectItemDlg(
itemidLoc : uint,
rguidProject : Guid,
pProject : IVsProject,
grfAddFlags : uint,
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 the AddItemWithSpecific method.
- rguidProject
Type: System.Guid%
[in] Identifier for the project's type. Register this parameter under the Projects subkey of the Microsoft Visual Studio registry key. The dialog box uses the following information under that key:The ItemTemplateDir value, which contains the path to the directory containing item templates for this project type.
The Filters key, which is used to construct open filters for the Existing tab.
Items and filters specific to this project type, which are displayed in the dialog box.
- pProject
Type: Microsoft.VisualStudio.Shell.Interop.IVsProject
[in] Pointer to the specific IVsProject interface that the dialog box uses to generate default names for each item by calling the interface's GenerateUniqueItemName method and to cause items to be added to the project by calling the AddItem method.
- grfAddFlags
Type: System.UInt32
[in] Flag values taken from the __VSADDITEMFLAGS enumeration that modify the behavior of the dialog box.
- lpszExpand
Type: System.String
[in] Subfolder of the item template directory to select and to expand, if it has subfolders of its own. This parameter merely initializes the state of the tree and does not affect what the item template directory is.
- lpszSelect
Type: System.String
[in] Item within the pszExpand folder to be selected. The project uses this parameter to implement a sticky behavior for the selected item. This parameter overrides the default behavior for the dialog box, which is to select the first item in the folder.
- pbstrLocation
Type: System.String%
[in, out] Pointer to the location field (initial/final value). This parameter is used only if you specify VSADDITEM_ShowLocationField. To specify a sticky behavior for the location field, which is the recommended behavior, remember the last location field value and pass it back in when you open the dialog box again.
- pbstrFilter
Type: System.String%
[in, out] Initializes and returns the final value of the filter string (on the Existing tab). Specify VSADDITEM_AllowStickyFilter to return a value for the filter string. To specify sticky behavior for the filter field, which is the recommended behavior, remember the last filter field value and pass it back in when you open the dialog box again.
- pfDontShowAgain
Type: System.Int32%
[out] Determines whether the user selected or cleared the Do not 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 own AddItem method. Typically, a project will maintain a separate DontShowAgain 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.
Implements
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsAddProjectItemDlg2::AddProjectItemDlg(
[in] VSITEMID itemidLoc,
[in] REFGUID rguidProject,
[in] IVsProject *pProject,
[in] VSADDITEMFLAGS grfAddFlags,
[in] LPCOLESTR lpszExpand,
[in] LPCOLESTR lpszSelect,
[in, out] BSTR *pbstrLocation,
[in, out] BSTR *pbstrFilter,
[out] BOOL *pfDontShowAgain
);
The caller must implement IVsProject to use this method. The dialog box is only a selection mechanism. The caller must perform the tasks necessary to add an item to a project and open it in an editor. The dialog box calls the AddItem method to add a selected file or template or a wizard to the project.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.