Microsoft KB Archive/89630

= Length Limits for OLE Item, File and Class Names =

Article ID: 89630

Article Last Modified on 10/27/1999

-

APPLIES TO


 * Microsoft OLE 1.0

-



This article was previously published under Q89630



The Windows 3.1 SDK's &quot;Programmer's Reference: Volume 1&quot; 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 &quot;C:\WINAPPS\WINWORD\WORDART\WORDART.EXE&quot; (38 characters), the command line that the OLE libraries would use to open a linked object is:

C:\WINAPPS\WINWORD\WORDART\WORDART.EXE /Embedding 

In this case, the maximum size of the linked filename &quot;&quot; is 78 characters (128 limit - 38 chars for server - 12 chars for the string &quot; -Embedding &quot;).

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.

Additional query words: 3.10 REGEDIT 1.00

Keywords: KB89630

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.