AddProject Method

Home Page (Objects)OverviewFAQReference

Applies to: Application object

Creates a new project and adds it to the workspace.

Syntax

object.AddProject "project name", "project directory", "project type", addfolders

Parameters

object

An expression that evaluates to an Application object.

project name

A String that contains the name of the new project.

project directory

A String that specifies the directory to place this project in. 

When your project directory ends with a backslash, you will get a project (.dsp) and workspace (.dsw) both called project name in the directory path you specified.

If you omit the backslash from the project directory but if all subdirectories in the project directory exist, you will get a project (.dsp) and workspace (.dsw) both called project name in the specified directory path.

However, if you omit the final backslash from project directory and if one of the directories in project directory does not exist, then the last subdirectory in the path becomes the workspace (.dsw) name and you get a .dsp file called project name.

project type

A String that specifies the type of the new project. The string must be one of the following:

String Description
"Application" A Win32 executable application
"DLL" A Win32 Dynamic-Link Library
"Console Application" A Win32 console application
"Static Library" A Win32 static link library
"Utility" A utility project
"Makefile" A makefile project

addfolders

A Variant that is a Boolean. Specifies whether to add the default file folders to the project.

Remarks

Developer Studio creates the project in the workspace directory, unless you specify a path for the first argument. For example, if you specify the path "c:\myproj\myproj.dsp", the project will be placed in the c:\myproj directory for you and will be named "myproj.dsp".

Developer Studio adds debug and release configuration to the project for you.

Example

The following example creates a new project and adds it to the workspace:

Sub AddMyFile
Application.AddProject "MyProj", "c:\myproj", "Console Application", True
End Sub