Problem Determination Guide: Tips and Hints

# Problem Determination Guide

# Tips and Hints

The following tips and hints are provided to assist you in trouble-shooting.

## If Part Fails to Load

Verify that the part DLL is loadable. Check that the part DLL and all the DLLs loaded by the part DLL can be loaded.

Verify that the part has been registered in the PartReg.bto file. Use ODDumpRg to list all the registered parts.

Verify that another IR file listed in SOMIR is not corrupted. From a command window, set the SOMIR environment variable to only include the ...\etc\opendoc.ir file.

If other parts can install, check the Meta information in the part's source file. This information includes the Part's Class name, DLL name, Part Kind name, and so on. See the samples provided in the OpenDoc Programming Guide for addtional information.

## SOMInitModule

Ensure that your part source includes a SOMInitModule. Refer to the samples provided in the OpenDoc Programming Guide for additional information.

## OpenDoc.ir File

Your machine SOMIR environment variable must include the opendoc.ir as illustrated in the following example:

         SOMIR=c:\opendoc\etc\opendoc.ir

Ensure that your part IDL file is in the opendoc.ir. To verify, enter:

         irdump mypart_classname

mypart_classname represents the class name of your part.

If irdump returns the following:

         "mypart_classname" not found.

## Environment Settings

The following environment settings are required for OpenDoc:

         SET ODBASE=c:\opendoc
         SET ODCFG=c:\opendoc\etc
         SET SOMIR=c:\opendoc\etc\opendoc.ir
         SET HELP=c:\opendoc\locale\en_US
         SET NLSPATH=c:\opendoc\locale\en_US\%N;

c:\opendoc, and that the language is English (en_US). Note that AIX uses EXPORT instead of SET.

More environment settings are required for OpenDoc Parts. Refer to the OpenDoc Programming Guide, Appendix C, Dynamic Binding under Installation of OpenDoc Software for more information.

### Platform Specific Environment Settings

Your OS/2 machine's LIBPATH environment variable must include the location of OpenDoc DLLs and your part DLL. If it is not specified, the part cannot run.

Your Windows NT/95 machine's PATH environment variable must include the location of OpenDoc DLLs and your part DLL. If it is not specified, the part cannot run. The PATH must also include the location of help files (.HLP files).

Your AIX machine's PATH environment variable must include the location of OpenDoc DLLs and your part DLL. If it is not specified, the part cannot run.

## Rebuilding Your Part DLL On an AIX System

While testing your part, you could make changes to the part before rebuilding the DLL. In this case, you may see a message similar to the following:

         ld: 0711-851 SEVERE ERROR: Output file: <your dll here>
               The file is in use and cannot be overwritten.

In AIX, DLLs stay mapped in memory. Enter the following as root:

         > slibclean

DLL.

## Path Settings On Windows NT

Path entries to directories that do not exist are not recognized and cause the user path to be dropped when your Windows NT system path is set at system startup. If you put an entry in your path that does not exist, the user path will not be appended to the system path when PATH is set.

This is true whether the entry that is not valid is at the beginning of the system PATH setting or at the end of the user PATH setting. Either way, the user portion of the path is not appended to the system path. This can occur if you include build directories that have not yet been created (that would be created by the build process).

When adding PATH entries, consider creating the directories at the same time, even though they are empty.

## Tips About OLE Scripting with Visual Basic

This section contains several scripting problems with possible causes and resolutions.

### Added Part not in Dialog Box

After you add your part into the form (either by an embedded OLE object or by adding a custom control) your part does not show up in the dialog box.

#### Possible Causes and Resolutions

1. You did not register your part.

   To resolve, run the odregprt command to register your part. For additional information about the odregprt command, see the OpenDoc Programming Guide.

2. The GUID is not set correctly in the meta data for your class.

   To resolve, set the GUID correctly, rebuild your part, and redo the part registration.

3. You did not create the TYPELIB or run the scriptrg command.

   To resolve, run the ctypelib command to create the TYPELIB, then run the scriptrg command to register the TYPELIB. For additional information about the ctypelib and scriptrg commands, see the OpenDoc Programming Guide.

   Note:

   > This problem only happens when you add the part as a custom control. If you add your part as an embedded OLE object, you are not required to create a TYPELIB. Creating a TYPELIB for the OLE object can speed up your application.

### Cannot Create Control Icon

You cannot create the custom control or the embedded OLE object after selecting the OK push button in the dialog box.

#### Possible Causes and Resolutions

1. A DLL path or OpenDoc environment variable is incorrectly set.

   The `odole.dll`, `oddsole.dll`, or the `.dll` file of your part is not in the path, or an OpenDoc environment variable is not set correctly. To resolve, ensure that your part DLL files are in the path and set all OpenDoc environment variables correctly.

2. The Part has a defect.

   To resolve, ensure that your part can be embedded in another OLE container such as MicroSoft Word.

### Event Function Prototype not in Code

The event function prototypes do not show up in your code.

#### Possible Causes and Resolutions

1. You did not set the event mechanism correctly in your IDL file.

   To resolve, set the event mechanism correctly in your IDL file and rebuild your part. For additional information on setting an IDL, see the OpenDoc Programming Reference.

2. You did not create the TYPELIB or run the scriptrg command.

   To resolve, run the ctypelib command to create the TYPELIB and run the scriptrg command to register the TYPELIB. For additional information about the ctypelib and scriptrg commands, see the OpenDoc Programming Guide.

   Note:

   > This problem only occurs when you add the part as a custom control. If you add your part as an imbedded OLE object, you are not required to create a TYPELIB. Creating a TYPELIB, can speed up your application.

### Receiving an OLE Automation Error

When you run your application, it is receiving an OLE automation error.

#### Possible Causes and Resolutions

1. The method or property you are trying to access is not exported.

   To resolve, add the ODid modifier to the method or property of your IDL file and rebuild the part.

2. The method parameters are not passing correctly.

   To resolve, ensure that your parameter number and parameter types are correct.

3. Incorrectly set ODGuid modifier of GUID meta data.

   You did not set the ODGuid modifier or did not use the GUID in the meta data for the class. To resolve, put the GUID in the IDL file and the meta data for the class and rebuild the part.

4. The GUID in the IDL and meta data for the class do not match.

   To resolve, use the same GUID value in both places and rebuild the part.

5. You did not rebuild the TYPELIB after you changed the IDL file.

   To resolve, run the ctypelib command to rebuild the TYPELIB. For additional information about the ctypelib command, see the OpenDoc Programming Guide.

6. The IDL changes are not in the Interface Repository.

   You did not update your Interface Repository file before creating the TYPELIB or before running the application (if you are not using a TYPELIB). To resolve, ensure the SOMIR environment variable is set correctly and run the irdump SOM utility to ensure that the latest changes are in the Interface Repository file. For additional information about the irdump utility, see the System Object Model Guide and Reference.

### Callback Function not Called

Your callback function is not being called.

#### Possible Causes and Resolutions

1. The ODGuid modifier is not defined for the event class in the IDL.

   To resolve, add the ODGuid modifier to the event class and rebuild the part.

2. The GUID for the event class is not being created during event manager creation.

   To resolve, use the GUID for the event class when creating the event manager.

### A Working Application does not Work

An application that worked previously is no longer working.

#### Possible Causes and Resolutions

1. The application has been moved to another directory.

   To resolve, rebuild the Visual Basic code and ensure that the PATH variable is set correctly.

2. The part code changed after creating the Visual Basic application.

   To resolve, delete the embedded part from the form and embed the part again.

[ Top | Previous | Next | Contents | Index | Documentation Homepage ]