Condividi tramite


OpenFontsDialog function

Opens the Microsoft Internet Explorer 4.0 version of the Fonts dialog box.

Syntax

INT_PTR STDAPI OpenFontsDialog(
  _In_ HWND   hDlg,
  _In_ LPCSTR lpszKeyPath
);

Parameters

  • hDlg [in]
    A handle to the parent window of the Fonts dialog box. This parameter can be NULL.

  • lpszKeyPath [in]
    A pointer to a string that specifies the registry path used to save fonts selections. The path should not include the registry hive name; HKEY_CURRENT_USER is assumed. See Remarks.

Return value

Returns TRUE if successful, or FALSE otherwise.

Remarks

Use the LoadLibrary function and the GetProcAddress function to import LaunchConnectionDialog from Inetcpl.cpl.

The OpenFontsDialog function retrieves a list of all the scripts on the system and displays the following Fonts dialog box.

Use the Fonts dialog box to select a default encoding, and to specify a proportional font and a fixed-width font for each script. When you click OK, the dialog box saves the settings to the registry using the path specified in lpszKeyPath. The path does not have to exist prior to the first time this function is called. The Fonts dialog box is used by Windows Internet Explorer and Microsoft Outlook Express.

Note  If "5.0" is found in the string passed to lpszKeyPath, the dialog box enumerates code pages with the user-default language ID instead of the system default.

 

This dialog box can be restricted by setting the following registry key to a non-zero value. HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Fonts = (DWORD) 1 .

Examples

This example shows how to use LoadLibrary and GetProcAddress to load and call OpenFontsDialog.

Security Warning: Using LoadLibrary incorrectly can compromise the security of your application by loading the wrong DLL. Refer to the LoadLibrary documentation for information on how to correctly load DLLs with different versions of Windows.

HMODULE hInetcpl = LoadLibrary("inetcpl.cpl");
if (hInetcpl == NULL)
{
   //Error loading module -- fail as securely as possible
   return;
}
   
typedef INT_PTR (STDAPI *OPENFONTSDLG) (HWND, LPCSTR);
OPENFONTSDLG fnOpenFontsDialog = (OPENFONTSDLG)GetProcAddress(hInetcpl, "OpenFontsDialog");
if(fnOpenFontsDialog)
{
   fnOpenFontsDialog(hwndParent, lpszRegkey);
}
FreeLibrary(hInetcpl);

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

N/A

DLL

Inetcpl.cpl