contents   index   previous   next



OLE strings

 

OLE Strings are null-terminated, wide-character strings. Fortran does not directly support OLE strings. However, a Fortran program can store OLE strings as vectors of two-byte integers, each entry containing the code of a character in the string. 32-bit Windows services and APIs expect OLE strings in their string arguments, although for backward compatibility, most of them can also receive null-terminated C (ANSI) strings. As a general rule, Windows API functions that expect OLE Strings have names terminated with a W, while those expecting ANSI strings have a name that ends with an A. For example, the string manipulation services offered by Windows NT include function LoadString that loads a string resource from an application's executable file. This function is available in two versions, LoadStringA for ANSI strings and LoadStringW for OLE/Unicode strings.

 

Figure 1.2 shows the memory representation of a standard OLE string, as well as the equivalent representation as a Fortran vector of two-byte integers.

 

With f90VB's BString library it is easy to call 32-bit Windows APIs that expect wide-character arguments, because f90VB offers the necessary functionality to convert Fortran Strings into OLE Strings and vice versa.

 

BStrings