Novell Home

TID101042 (gw5xc313) C3PO Delphi 2.0 Example

From Developer Community

ABSTRACT:

Use C3POs to add a toolbar button and also trap the open mail command.

DETAILED DESCRIPTION

Attached is a Delphi 2.0 sample program that adds a button to the toolbar and also traps the open mail command.

The following items the most important things to know when reviewing the code: 1. If starting a C3PO project from scratch, click on File|New|Automation Object. This will create an automation object for your C3PO and generate a GUID for you (see the end of servobj.pas for the ClassID which is the GUID). 2. The ProgID (shown at the end of the servobj.pas file) is what must be listed in your windows registration. 3. You register your C3PO application by running your ?.reg file (see c3poauto.reg for an example of the lay out). 4. Once you run your ?.reg file you can view the changes to your Windows registration file by running REGEDIT from the START|RUN option. Once in regedit, click on HKEY_LOCAL_MACHINE|SOFTWARE|Novell|GroupWise|5.0|C3PO|DataTypes. All entries under DataTypes are your entries or entries created by another registered C3PO. 5. Notice in the regedit program that GW.CLIENT is registered with this sample program-- Echo.C3POEcho. Under that is Events and Objects. Events gives you notice of ready and shutdown (on arrival could have been added as well). 6. Under GW.MESSAGE.MAIL is Echo.C3POEcho. Under this is Events and Objects. Events traps the open command and Objects has the IconFactory which displays our toolbar icon. 7. The second registration item is to run your c3po with a /regserver (e.g.; c3po_prj.exe /regserver) 8. Now load the Delphi sample and look at c3po.pas. This file has three important functions. First, look at some of the variables near the top to the file (search on GW.MESSAGE.MAIL to find the variables). Now go and view the Want, Build, and Execute functions. These three functions are the heart of the C3PO. Notice how the variables relate to the commands being made. 9. Put a break in each of these functions and start the c3po. Now start groupwise. Double click on a mail item and see what happens. 10. If a new icon does not show then make sure icon.dll is in the windows directory (icon.dll comes with this sample).

GW5XC313.EXE

gw5xc313.exe162.4 K2005-04-06

--devsup

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.