3.13 Using C++

3.13.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.

C3POSERVER.CPP

GWCOMMAND.CPP

C3POSERVER.H

GWCOMMAND.H

CLASSFACTORY.CPP

ICONFACTORY.CPP

CLASSFACTORY.H

ICONFACTORY.H

COMMANDFACTORY.CPP

README.TXT

COMMANDFACTORY.H

UTIL.CPP

EVENTMONITOR.CPP

UTIL.H

EVENTMONITOR.H

XXX.WIZ

3.13.2 Standard Files

You also need to import several files (available in the GroupWise C3PO download) to your project.

The following files are available from the c:\novell\ndk\groupwise\gw_5\c3po\tools\c3powizard\samples\cpp\c3pobywiz directory:

  • C3PODLL.CPP

  • C3PODLL.DEF

  • C3PODLL.H

The following files are available from the c:\novell\ndk\groupwise\gw_5\c3po\tools\c3powizard\samples\cpp\include directory:

  • GWC3PO.H

  • GWC3CMD.H

There are several versions of the last needed file, depending on how many times it has been updated. As of October 2004, the latest version is the gwoapi6.h file, which should be available in several places in your GroupWise download directory.

NOTE:If you are creating a customized button to add to one of your toolbars, add the DLL file for your customized button to the directory where your C3PO source files are located. For example, if you want to add the customized button, which is a picture of some flowers, that comes with the GroupWise download; add the icons.dll file to the same directory where your C3PO source files are located. Otherwise, your button will never appear.

3.13.3 Creating a .DLL File

Now that you have created a C3PO for C++, 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.

The options in parentheses refer to Visual C++ 5.0. If you are using another application builder, your options may differ.

  1. Start your C++ application builder.

  2. Create a new empty Win32 DLL project (File New). Name the project name the same name you named your project in the C3PO wizard.

  3. Insert all new .CPP and .H files created by the C3PO wizard into your project (Project Add to Project Files).

  4. Insert the c3podll.def file into your project.

  5. Update the wizard to use the newest version of the gwoapi.h file.

    There are several places in the C3PO code that is created by the wizard where the code tries to include the gwoapi.h header file. If you are using a later version of gwoapi.h, be sure to change all references to use the version of the file that you are using (for example, gwoapi6.h).

  6. Edit the c3podll.cpp file.

    Go to the DLLMain function. Change the line that states

    CTShInstance = hModule

    to read

    CTShInstance = (HINSTANCE)hModule
  7. If you are adding your own customized button, edit the commandfactory.cpp file to change the references to icons.dll to use your new dll name.

    You also need to change the reference to the gwcommand.cpp file to the new ID of your customized button.

  8. Build your .DLL file (Build Project).

3.13.4 Registering Your C3PO

  1. Switch to your Windows desktop.

  2. Register the C3PO with GroupWise and Windows 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.

    (Click here for information about Unregistering a C3PO.)

3.13.5 Testing Your C3PO

  1. Switch to your C++ application builder.

  2. Open the .DLL project you created under Creating a .DLL File.

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

  4. Run the C3PO from your C++ IDE. (The C3PO will do nothing because GroupWise has not yet been started.)

  5. 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.13.6 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

3.13.7 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/Cpp/Samples/

The C3POBYWIZ.WIZ sample:

  • Creates a new menu item under the File menu

  • Creates a new button