Setting up sample C++ plug-ins

This task involves building and running the sample ActiveX server DLL.

The sample provides a functioning Developer Studio workspace that you can use to set breakpoints and to observe the behavior of a typical iSeries™ Navigator plug-in. It also allows you to verify that your Developer Studio environment is set up correctly for compiling and linking plug-in code.

In order to get the sample C++ plug-in running or your PC, you must complete the following steps:

Download the C++ plug-in Download the executable file cppsmppq.exe. When you run the file it will extract all the files associated with the plug-in. Make a new directory, c:\MyProject, and copy all the files into it. If you create a different directory, you will have to modify registry file to specify the correct location for the plug-in.
Prepare to build an ActiveX server .dll
  1. Create a new directory that is named "MyProject" on your local hard drive. This example assumes that the local drive is the C: drive.
    Note: If the new directory is not c:\MyProject, you will need to change the registry file.
  2. Copy all of the sample files into this directory. You can download the samples from the Programmer's Toolkit - iSeries Navigator Plug-ins Web page.
  3. In the Developer Studio, open the File menu and select Open Workspace.
  4. In the Open Project Workspace dialog, switch to the MyProject directory and in Files of Type: select Makefiles (*.mak).
  5. Select sampext.mak and click Open.
  6. Open the Tools menu and select Options...
  7. In the Directories tab, make sure that the Client Access Include directory appears at the top of your Include files search path.
  8. In Show directories for:, select Library files. Make sure that the Client Access Lib directory appears at the top of your Library files search path.
  9. Click OK to save the changes, then close and reopen Developer Studio. This is the only known way to force Developer Studio to save the search path changes to your hard disk.
Build the ActiveX server DLL
  1. In the Developer Studio, open the Build menu and select Set Default Configuration...
  2. In the Default Project Configuration dialog, select samptext Win32 Debug Configuration.
  3. Open the Build menu and select Rebuild All to compile and link the DLL.
    Note: If the DLL does not compile and link cleanly, double-click the error messages in the Build window to locate and fix the errors. Then open the Build menu and select sampext.dll to restart the build.
Build the resource library

The resource DLL that contains the translatable text strings and other locale-dependent resources for the plug-in is included with the sample. This means that you do not have to create this DLL on your own. Even if your plug-in supports only one language, your plug-in code must load its text strings and locale-specific resources from this resource library.

To build the resource DLL, complete the following steps:

  1. In Developer Studio, open the File menu and select Open Workspace... and select the MyProject directory.
  2. Specify Makefiles (*.mak) in Files of Type:.
  3. Select sampmri.mak and click Open.
  4. Open the Build menu and select Rebuild All to compile and link the DLL.
Register the ActiveX server .dll

The SAMPDBG.REG file in the MyProject directory contains registry keys that communicate the location of the sample plug-in on your workstation to the iSeries Navigator. If you specified a directory other than c:\MyProject, complete the following steps.

  1. Open the SAMPDBG.REG file in the Developer Studio (or use your chosen text editor).
  2. Replace all occurrences of "c:\\MyProject\\" with "x:\\<dir>\\," where x is the drive letter where your directory resides and <dir> is the name of the directory.
  3. Save the file.
  4. In Windows® Explorer, double-click the SAMPDBG.REG file. This will write the entries in the registry file to the Windows registry on your machine.
Run iSeries Navigator in the debugger

To run iSeries Navigator and observe the sample plug-in in action, complete the following steps.

  1. In Developer Studio, open the Build menu and select Debug > Go.
  2. At the prompt, type the fully-qualified path to the iSeries Navigator executable in the iSeries Access for Windows Install directory on your workstation. The path will be C:\PROGRAM FILES\IBM\CLIENT ACCESS\CWBUNNAV.EXE or something similar.
  3. Click OK. The main window of the iSeries Navigator will open.
  4. Because you have just registered a new Navigator plug-in, a dialog in iSeries Navigator will prompt you to scan for the new plug-in.
  5. After the progress indicator finishes, click OK in the resulting dialog.
  6. After the Navigator window refreshes, a new folder (3rd Party Sample Folder) appears in the hierarchy under the iSeries server that was initially selected. You can now interact with the plug-in in iSeries Navigator and observe its behavior in the debugger.
Related concepts
Programmer's Toolkit - iSeriesNavigator Plug-ins Web page