IVsAddProjectItemDlg2.AddProjectItemDlg Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Displays the Add Item dialog box on behalf of the calling project.
public:
int AddProjectItemDlg(System::UInt32 itemidLoc, Guid % rguidProject, Microsoft::VisualStudio::Shell::Interop::IVsProject ^ pProject, System::UInt32 grfAddFlags, System::String ^ lpszExpand, System::String ^ lpszSelect, [Runtime::InteropServices::Out] System::String ^ % pbstrLocation, [Runtime::InteropServices::Out] System::String ^ % pbstrFilter, [Runtime::InteropServices::Out] int % pfDontShowAgain);
public int AddProjectItemDlg (uint itemidLoc, ref Guid rguidProject, Microsoft.VisualStudio.Shell.Interop.IVsProject pProject, uint grfAddFlags, string lpszExpand, string lpszSelect, out string pbstrLocation, out string pbstrFilter, out int pfDontShowAgain);
abstract member AddProjectItemDlg : uint32 * Guid * Microsoft.VisualStudio.Shell.Interop.IVsProject * uint32 * string * string * string * string * int -> int
Public Function AddProjectItemDlg (itemidLoc As UInteger, ByRef rguidProject As Guid, pProject As IVsProject, grfAddFlags As UInteger, lpszExpand As String, lpszSelect As String, ByRef pbstrLocation As String, ByRef pbstrFilter As String, ByRef pfDontShowAgain As Integer) As Integer
Parameters
- itemidLoc
- 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(UInt32, VSADDITEMOPERATION, String, UInt32, String[], IntPtr, UInt32, Guid, String, Guid, VSADDRESULT[]) method.
- rguidProject
- 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
- 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(UInt32, String, String, String) method and to cause items to be added to the project by calling the AddItem(UInt32, VSADDITEMOPERATION, String, UInt32, String[], IntPtr, VSADDRESULT[]) method.
- grfAddFlags
- UInt32
[in] Flag values taken from the __VSADDITEMFLAGS enumeration that modify the behavior of the dialog box.
- lpszExpand
- 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
- 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
- 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
- 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
- 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(UInt32, VSADDITEMOPERATION, String, UInt32, String[], IntPtr, VSADDRESULT[]) method. Typically, a project will maintain a separate DontShowAgain option for each item type, such as Form, Module, and Class.
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 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.