GenerateRegFile function
Description
Creates a file with registry update instructions for deploying
a PowerBuilder object as an automation server.
Controls
PowerBuilder.Application (automation server)
Syntax
1 |
{ <i>automationobject</i>.} <b>GenerateRegFile</b> ( <i>guid</i>, <i>classname</i>, <i>progid</i>, <br /> <i>majorversion</i>, <i>minorversion</i>, <i>description</i>, <i>outputfilename</i> ) |
Argument | Description |
---|---|
automationobject | When PowerBuilder is the OLE client, the name of the OLEObject instantiated with the PowerBuilder.Application automation server. For other clients, use syntax appropriate for calling a function belonging to an automation object |
guid | A string whose value is the globally unique identifier (GUID) that you want to use for the object. You can specify a GUID that you:
|
classname | A string whose value is the name of the class user object that will be the automation server. The object must be in one of the libraries specified in the LibraryList property |
progid | A string whose value is the programmatic identifier that people will use to connect to your server |
majorversion | An integer whose value you want to use for the major version number of your server object |
minorversion | An integer whose value you want to use for the minor version number of your server object |
description | A string whose value is a description of your server object. The description will be displayed in the Registry Editor and other OLE browsers |
outputfilename | A string whose value is the name of the file the GenerateRegFile will create. The default filename extension recognized by the registry is .REG |
Return Values
Long. Returns a status code indicating whether an error occurred.
Values are:
- 0 The registry update file was generated successfully
- -1 Memory allocation error
- -2 No output filename was provided
- -3 Unable to open the output file
- -9 Unknown error
Usage
Before you call GenerateRegFile, you must start a PowerBuilder.Application session
and set the LibraryList and MachineCode properties to the value
that the server object will use. You also need a GUID to serve as
the object’s class identifier (CLSID). For information
about the format of a GUID, see the GenerateGUID function.
After you create a registry update file, you can also generate
a type library file for the object, which provides browsing information
for your server object. See the GenerateTypeLib function.
The default extension for a registry update file is REG. You
can install the object in the registry by double-clicking on the
update file. Information is installed in the registry about the
object, including the location of its DLL and the location of its
type library file, if any. For how to use a PowerBuilder tool to register
objects, see “Registering the object”.
Examples
This example calls GenerateRegFile. (Don’t
use this GUID in your own applications!)
1 |
long ll_result |
1 |
ll_result = GenerateRegFile( & |
1 |
"{12345678-1234-1234-1234-123456789012}", & |
1 |
"uo_salary_formulas", & |
1 |
"MyCompany.SalaryFormulas", & |
1 |
1, 0, & |
1 |
"PowerBuilder functions for calculating & |
1 |
salaries", c:pbdsizrules.reg") |
This example establishes a PowerBuilder.Application server session
and sets all the values necessary for generating a registry update
file.
1 |
oleObject PBObject |
1 |
string ls_GUID |
1 |
long ll_result |
1 |
1 |
PBObject = CREATE oleObject |
1 |
1 |
result = PBObject.ConnectToNewObject & |
1 |
("PowerBuilder.Application") |
1 |
IF result < 0 THEN |
1 |
// Handle the error |
1 |
ELSE |
1 |
PBObject.LibraryList = "c:myapplmylibrary.pbd" |
1 |
PBObject.MachineCode = FALSE |
1 |
1 |
ll_result = PBObject.GenerateGUID(REF ls_GUID) |
1 |
IF ll_result < 0 THEN |
1 |
// Handle the error |
1 |
ELSE |
1 |
ll_result = PBObject.<i>GenerateRegFile</i> ( & |
1 |
ls_GUID, & |
1 |
"uo_myserverobject", & |
1 |
"MyCompany.Object", & |
1 |
1, 0, & |
1 |
"My object's description", & |
1 |
"c:myapplobject.reg") |
1 |
1 |
IF ll_result < 0 THEN |
1 |
// Handle the error |
1 |
ELSE |
1 |
// Generate Type Library |
1 |
END IF |
1 |
END IF |
1 |
END IF |
See Also
- GenerateGUID
- GenerateTypeLib