SccCreateSubProject Function

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This function creates a subproject with the given name under an existing parent project specified by the lpParentProjPath argument.

SCCRTN SccCreateSubProject(
   LPVOID pContext,
   HWND   hWnd,
   LPSTR  lpUser,
   LPCSTR lpParentProjPath,
   LPCSTR lpSubProjName,
   LPSTR  lpAuxProjPath,
   LPSTR  lpSubProjPath



[in] The source control plug-in context pointer.


[in] A handle to the IDE window that the source control plug-in can use as a parent for any dialog boxes that it provides.


[in, out] The username (up to SCC_USER_SIZE, including the NULL terminator).


[in] A string identifying the path of the parent project (up to SCC_PRJPATH_SIZE, including the NULL terminator).


[in] The suggested subproject name (up to SCC_PRJPATH_SIZE, including the NULL terminator).


[in, out] Auxiliary string identifying the project (up to SCC_PRJPATH_SIZE, including the NULL terminator).


[in, out] Output string identifying the path for the subproject (up to SCC_PRJPATH_SIZE, including the NULL terminator).

The source control plug-in implementation of this function is expected to return one of the following values:

Value Description


Subproject was successfully created.


Parent project could not be initialized.


The user could not log in to the source control system.


Subproject cannot be created.


Invalid project syntax.


The parent project is unknown to the source control plug-in.


Invalid or unusable file path.


The user is not allowed to perform this operation.


There was a problem accessing the source control system, probably due to network or contention issues. A retry is recommended.


There was a source control plug-in connection problem.



Nonspecific failure.

If a subproject with the name already exists, the function can change the default name to create a unique one, for example by adding "_<number>" to it. The caller must be prepared to accept changes to lpUser, lpSubProjPath, and lpAuxProjPath. The lpSubProjPath and lpAuxProjPath arguments are then used in a call to the SccOpenProject Function. They should not be modified by the caller upon return. These strings provide a way for the source control plug-in to track information that it needs to associate with a project. The caller IDE will not display these two parameters upon return, because the plug-in can use a formatted string that might not be suitable for viewing. The function returns a success or failure code and, if successful, fills the variable lpSubProjPath with the full project path to the new project.

This function is similar to the SccGetProjPath Function, except that it silently creates a project rather than prompting the user to select one. When the SccCreateSubProject function is called, lpParentProjName and lpAuxProjPath will not be empty and will correspond to a valid project. These strings are usually received by the IDE from a previous call to the SccGetProjPath function or the SccGetParentProjectPath Function.

The lpUser argument is the user name. The IDE will pass in the same user name that it had previously received from SccGetProjPath, and the source control plug-in should use the name as a default. If the user already has an open connection with the plug-in, then the plug-in should try to eliminate any prompts to make sure the function works silently. However, if the login fails, the plug-in should prompt the user for a login and, when it receives a valid login, pass the name back in lpUser. Because the plug-in may change this string, the IDE will always allocate a buffer of size (SCC_USER_LEN+1 or SCC_USER_SIZE, which includes space for the null terminator). If the string is changed, the new string must be a valid login name (at least as valid as the old string).

Adding solutions and projects to source control has been simplified in Visual Studio to minimize the number of times a user is prompted to select locations in the source control system. These changes are activated by Visual Studio if a source control plug-in supports both of the new functions, SccCreateSubProject and SccGetParentProjectPath. However, the following registry entry can be used to disable these changes and revert to previous Visual Studio (Source Control Plug-in API Version 1.1) behavior:

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\SourceControl] "DoNotCreateSolutionRootFolderInSourceControl"=dword:00000001

If this registry entry does not exist or is set to dword:00000000, Visual Studio attempts to use the new functions, SccCreateSubProject and SccGetParentProjectPath.

If the registry entry is set to dword:00000001, Visual Studio does not attempt to use these new functions, and the operations of adding to source control work as they did in prior versions of Visual Studio.

Community Additions