Length Limits for OLE Item, File and Class Names (89630)



The information in this article applies to:

  • Microsoft OLE 1.0

This article was previously published under Q89630
The Windows 3.1 SDK's "Programmer's Reference: Volume 1" does not mention what the size limits for OLE item names, file names for linked OLE objects, and OLE class names. The maximum sizes of these components are listed below:
   OLE class name:         64 characters
   OLE linked filename:    Less than 98 characters (see note below)
   OLE item name:          115 characters
		
The OLE class name identifies your OLE class in the registration database, and is the first component of the ObjectLink and OwnerLink clipboard formats. The size of this name is limited by the maximum string that the registration database can hold, which is 64 characters.

The OLE linked filename is used when specifying a linked object, and is the second component in the ObjectLink and OwnerLink clipboard formats. Within the OLE libraries, this name is limited to 123 characters, but the actual limit is much smaller. Since a linked filename can be passed to the server application on the command line, the size of this name is limited by both the size of the server executable path (which typically varies for each server) and the size of the MS-DOS command line (which is 128 characters).

For example, assuming the server application is entered in the registration database as "C:\WINAPPS\WINWORD\WORDART\WORDART.EXE" (38 characters), the command line that the OLE libraries would use to open a linked object is:

C:\WINAPPS\WINWORD\WORDART\WORDART.EXE /Embedding <Linked File>

In this case, the maximum size of the linked filename "<Linked File>" is 78 characters (128 limit - 38 chars for server - 12 chars for the string " -Embedding ").

Due to the variable length of server path names, it is difficult to predict what the maximum allowable size for the linked filename is, but a safe maximum is about 50 characters.

Another method of determining the maximum size of the linked filename is to query the registration database to get the size of your server executable's path. Then you can use this information to determine the maximum linked filename length, and notify the user if they are exceeding this length.

The third component of the ObjectLink and OwnerLink clipboard formats is the OLE item name. This name cannot be longer than 115 characters. Due to a bug in the OLE libraries, exceeding this 115 character limit may cause your stack to be overwritten, so your application should manually verify that this string does not exceed 115 characters.

Modification Type:MajorLast Reviewed:10/27/1999
Keywords:KB89630