3.10 Using Visual Basic .dll

IMPORTANT: Use these procedures only if you chose not to have the wizard create a Visual Basic project (.VBP) file. That is, you answered No in Step 4 of Completing the C3PO.

(If you answered Yes, click here for Using Visual Basic.exe.)

These procedures assume you chose not to create a .VBP file because you want to create a .DLL file for your C3PO.

This section includes

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

  • C3POSERV.CLS

  • COMMANDF.CLS

  • EVENTMON.CLS

  • ICONFACT.CLS

  • GWCOMMAN.CLS

  • README.TXT

  • STARTUP.BAS

  • XXX.WIZ

3.10.2 Creating a .DLL File

Now that you have created a C3PO for Visual Basic, 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. Start Visual Basic.

  2. Create a new ActiveX DLL project (File New Project).

  3. Remove the class file from the project that automatically was inserted into your new project. Do not save the class file.

  4. Insert the STARTUP.BAS file into your project (Project Add Module).

  5. Insert the .CLS files into your project (Project Add Class Module).

  6. Name your project (use Project>Properties menu item) the same name that you used in the C3PO Wizard.

  7. Create your .DLL (File Make).

  8. Save your project to the same directory.

  9. Remove your project from the Visual Basic environment.

3.10.3 Registering Your C3PO with Windows

  1. Register the C3PO with Windows by using the following syntax at a DOS prompt or by running it from Windows (Start Run).

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

    The REGSVR32.EXE is required for in-process servers. This utility places important information about the server into the systems registry.

    • XXXC3PO represents the unique name of your C3PO.

    • 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 with Windows.)

3.10.4 Registering Your C3PO with GroupWise

  1. Switch to Visual Basic.

  2. Create a new Standard .EXE project (File New Project).

  3. Double-click the form

  4. In the form load handler, call the REGC3PO procedure.

  5. Add the STARTUP.BAS file to your project (Project Add Module). STARTUP.BAS contains the REGC3PO procedure.

  6. Run your project. This will register your C3PO with GroupWise.

(Click here for information about Unregistering a C3PO with Windows and Unregistering Your C3PO with GroupWise.)

3.10.5 Testing Your C3PO

  1. Copy the ICONS.DLL file (downloaded with the wizard) into the same directory where your other C3PO files are located.

  2. Remove the new .EXE project, and open the .DLL project you created under Creating a .DLL File.

  3. Insert breakpoints in your C3PO procedures. To enable breakpointss, go to the Project>Properties>Component tab and change the start mode from "standalone" to "ActiveX component." This will ensure that the appropriate procedures are called and that your C3PO is being implemented correctly.

  4. Run the C3PO from Visual Basic. (The C3PO will not execute because GroupWise has not yet been started.)

  5. Start GroupWise.

    • If your C3PO handles the Ready event, or if you created a new menu item or toolbar button which should be visible, the C3PO should now stop at your breakpoint.

    • If your C3PO is waiting for another event, you should cause that event to occur. The C3PO should then stop at your breakpoint.

3.10.6 Unregistering a C3PO with Windows

If you ever need to unregister your C3PO with Windows or DOS, follow these steps:

  1. Go to Windows Start>Run or a DOS prompt.

  2. Unregister the C3PO by using the syntax:

    c:\WINDOWS\SYSTEM\REGSVR32.EXE /U XXXC3PO.DLL

3.10.7 Unregistering Your C3PO with GroupWise

If you ever need to unregister your C3PO with GroupWise, follow these steps:

  1. Switch to Visual Basic.

  2. Create a new Standard .EXE project (File New Project).

  3. Double-click the form

  4. In the form load handler, call the UNREGC3PO procedure.

  5. Add the STARTUP.BAS file to your project (Project Add Module). STARTUP.BAS contains the UNREGC3PO procedure.

  6. Run your project. This will unregister your C3PO with GroupWise.

3.10.8 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/Vb/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