共用方式為


IVsProjectFactory.CreateProject Method

Definition

Creates a new project.

public:
 int CreateProject(System::String ^ pszFilename, System::String ^ pszLocation, System::String ^ pszName, System::UInt32 grfCreateFlags, Guid % iidProject, [Runtime::InteropServices::Out] IntPtr % ppvProject, [Runtime::InteropServices::Out] int % pfCanceled);
public int CreateProject (string pszFilename, string pszLocation, string pszName, uint grfCreateFlags, ref Guid iidProject, out IntPtr ppvProject, out int pfCanceled);
abstract member CreateProject : string * string * string * uint32 * Guid * nativeint * int -> int
Public Function CreateProject (pszFilename As String, pszLocation As String, pszName As String, grfCreateFlags As UInteger, ByRef iidProject As Guid, ByRef ppvProject As IntPtr, ByRef pfCanceled As Integer) As Integer

Parameters

pszFilename
String

[in] File name of the project that will be created.

pszLocation
String

[in] Location where the project will be created.

pszName
String

[in] If applicable, the name of the template to use when cloning a new project.

grfCreateFlags
UInt32

[in] Set of flag values taken from the __VSCREATEPROJFLAGS enumeration.

iidProject
Guid

[in] Identifier of the interface that the caller wants returned.

ppvProject
IntPtr

nativeint

[out, iid_is(iidProject)] Pointer to the interface specified by iidProject.

pfCanceled
Int32

[out] Returns true if the user presses the Cancel button to abort the creation of this project. Otherwise, it is false.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsProjectFactory::CreateProject(  
   [in] LPCOLESTR pszFilename,  
   [in] LPCOLESTR pszLocation,  
   [in] LPCOLESTR pszName,  
   [in] VSCREATEPROJFLAGS grfCreateFlags,  
   [in] REFIID iidProject,  
   [out, iid_is(iidProject)] void **ppvProject,  
   [out] BOOL *pfCanceled  
);  

CreateProject is called by the shell when a user tries to create a new project.

Create a new project by cloning an existing template project (which could be empty). The environment uses the file extension to determine the VSPackage on which to call this method.

Applies to