Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at

XPInstall API Reference:WinReg Object:Methods:createKey


Adds a key to the registry.

Method of

WinReg object


int createKey ( String subkey, String classname);


The method has the following parameters:

The key path to the appropriate location in the key hierarchy, such as "Software\\Netscape\\Navigator\\Mail".
Usually an empty string. For information on this parameter, see the description of RegCreateKeyEx in your Windows API documentation.


0 if it succeeded; a nonzero number if it failed to schedule the creation. For a list of possible values, see Return Codes.


The createKey method adds a key to the registry. You must add a key to the registry before you can add a value for that key.

Document Tags and Contributors

 Last updated by: Anonymous,