The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at CreateSafeName.

Generates a C++ friendly name.

      function CreateSafeName(   


The old name.

The new, safe name.

Call this function to create a C++ friendly name from a name that contains characters that cannot be used by C++. An acceptable C++ name can contain upper- or lowercase letters, digits, or an underscore ("_").

This function checks the old name character by character, skipping any unusable characters. If the old name contains no friendly characters, the function returns the new name as "My". If the new friendly name begins with a digit, this function prepends the new name with "My".

// Get the project name  
var strProjectName = wizard.FindSymbol("PROJECT_NAME");  
// Set the project name to the safe project name.   
var strSafeProjectName = CreateSafeName(strProjectName);  

Customizing C++ Wizards with Common JScript Functions
JScript Functions for C++ Wizards
Creating a Custom Wizard
Designing a Wizard