AddFontResource

Syntax

int AddFontResource(lpFilename)

This function adds the font resource from the file named by the lpFilename parameter to the Windows font table. The font can subsequently be used by any application.

Parameter Type/Description  

lpFilename LPSTR Points to a character string that names the font-resource file or contains a handle to a loaded module. If lpFilename points to the font-resource filename, the string must be null-terminated, have the DOS filename format, and include the extension. If lpFilename contains a handle, the handle is in the low-order word and the high-order word is zero.  

Return Value

The return value specifies the number of fonts added. The return value is zero if no fonts are loaded.

Comments

Any application that adds or removes fonts from the Windows font table should notify other windows of the change by using the SendMessage function with the hWnd para-meter set to –1 to send a WM_FONTCHANGE message to all top-level windows in the system.

It is good practice to remove any font resource an application has added once the application is through with the resource.

For a description of font resources, see the Guide to Programming.