3.11 Using Delphi .dll

IMPORTANT: Use these procedures only if you chose to have the wizard create a Delphi project file (.DPR). That is, you answered Yes in Step 4 of Completing the C3PO.

(If you answered No, Click here for Using Delphi .exe.)

This section includes

3.11.1 New Files

Your new C3PO consists of the following files, which are located in the directory you specified in Step 1 of Starting the Wizard.

  • XXXC3PO.PAS

  • XXXREADME.TXT

  • XXXSERV.PAS

  • XXX.DPR

  • XXX.WIZ

3.11.2 Creating a .DLL File

Now that you have created a C3PO for Delphi, you need to perform the following steps to make your C3PO work for you. Unless otherwise specified, all files you create using these procedures should be placed in the same directory as the new C3PO files listed above.

  1. Copy the C3POINC.PAS file (downloaded with the wizard) to the same directory as your new C3PO files.

  2. Start Delphi.

  3. Open the project (XXX.DPR) that was created by the wizard (File Open).

  4. Build the project (Project Build).

    • If your C3PO does not use constants, a compile error may occur. If this happens, note which CONST statement is causing the error, comment it out, then recompile.

3.11.3 Registering Your C3PO

  1. Switch to your Windows desktop.

  2. Register the C3PO by running it from Windows (Start Run) using the syntax:

    C:\WINDOWS\SYSTEM\REGSVR32.EXE xxxC3PO.DLL

    NOTE: xxxC3PO represents the unique name of your C3PO. Also, this syntax assumes the REGSVR32.EXE program on your system is located in the C:\WINDOWS\SYSTEM directory. If it is not, adjust the syntax accordingly.

  3. Registration of your C3PO takes place automatically in GroupWise. No further registration steps are necessary.

    (Click here for information about Unregistering a C3PO.)

3.11.4 Testing Your C3PO

  1. Switch to Delphi.

  2. Open your .DLL project.

  3. Select Run Parameters, then enter the path to your GroupWise application (GRPWISE.EXE).

  4. Insert breakpoints in your C3PO procedures. This will ensure that the appropriate procedures are called and that your C3PO is being implemented correctly.

  5. Run your C3PO. (The C3PO will not execute because GroupWise has not yet been started.)

  6. Start GroupWise.

    • Depending on which events or menu items your C3PO is programmed to handle, your application should stop at your breakpoints or immediately after you cause your events to occur in GroupWise.

3.11.5 Unregistering a C3PO

Should you ever need to unregister your C3PO, follow these steps:

  1. Switch to your Windows desktop.

  2. Unregister the C3PO from GroupWise and Windows by running the C3PO from a DOS prompt using the syntax:

    C:\WINDOWS\SYSTEM\REGSVR32\XXXC3PO /U

    • The C3PO STARTUP.BAS file calls the sub main procedure.

    • sub main calls the RegC3PO command.

    • RegC3PO unregisters the C3PO from both GroupWise and Windows.

3.11.6 Sample C3PO

The GroupWise SDK includes a sample C3PO named C3POBYWIZ.WIZ that you can copy and use as you wish. This sample is located in the following directory:

Novell/Ndk/GroupWise/Gw_5/C3po/Tools/C3poWizard/Delphi/Samples/

The C3POBYWIZ.WIZ sample:

  • Handles Ready and Shutdown events

  • Creates a new menu item under the File/New menu

  • Creates a new context menu item

  • Creates a custom class

  • Handles the Open command of that custom class