CHOOSEFONT_TYPE Structure

Type CHOOSEFONT_TYPE
  lStructSize As Long
  hwndOwner As Long
  hDC As Long
  lpLogFont As Long
  iPointSize As Long
  Flags As Long
  rgbColors As Long
  lCustData As Long
  lpfnHook As Long
  lpTemplateName As String
  hInstance As Long
  lpszStyle As String
  nFontType As Integer
  MISSING_ALIGNMENT As Integer
  nSizeMin As Long
  nSizeMax As Long
End Type

Description & Usage

The CHOOSEFONT_TYPE structure is designed to pass information to and from the Choose Font common dialog box. Its members both specify initialization settings for rendering the box and receive information about the user's selection after the function completes.

Visual Basic-Specific Issues

Officially, this structure is called CHOOSEFONT. However, that violates the case-sensitive name spacing of Visual Basic because Visual Basic cannot then distinguish it from the ChooseFont API function. The Windows API Guide calls this structure CHOOSEFONT_TYPE to avoid the naming collision.

Data Members

lStructSize
The size in bytes of this structure.
hwndOwner
A handle to the window which is opening the Choose Font common dialog box, if any.
hdc
A handle to a device context or information context to the printer to read the printer fonts of. This must be specified if you want to display printer fonts in the font list.
lpLogFont
A pointer to a memory block which receives the contents of a LOGFONT structure specifying the attributes of the font the user selected. Optionally, this data block can also be initialized with the font to select by default in the dialog box. See the example for ChooseFont for how to obtain this address to a memory block.
iPointSize
The point size of the font, measured in units of 1/10 of a point (for example, 120 means 12 point).
Flags
A combination of the following flags specifying options for creating the Choose Font dialog box:
CF_ANSIONLY
List all fonts using a Windows or Unicode character set. Note: This flag is obsolete; use CF_SCRIPTSONLY instead.
CF_APPLY
Display and enable the Apply button.
CF_BOTH
List all printer and screen fonts.
CF_EFFECTS
Allow the strikeout, underline, and color attributes to be set.
CF_ENABLEHOOK
Use the hook function specified by lpfnHook to process the Choose Font dialog's messages.
CF_ENABLETEMPLATE
Use the dialog box template specified by lpTemplateName.
CF_ENABLETEMPLATEHANDLE
Use the preloaded dialog box template specified by hInstance.
CF_FIXEDPITCHONLY
List only fixed-pitch fonts.
CF_FORCEFONTEXIST
Do not allow the user to select a non-listed font.
CF_INITTOLOGFONTSTRUCT
Use the settings specified in lpLogFont to select a default font in the dialog box.
CF_LIMITSIZE
Limit the point size selection to values between nSizeMin and nSizeMax inclusive.
CF_NOOEMFONTS
Same as CF_NOVECTORFONTS.
CF_NOFACESEL
Do not select a default font face name for the user.
CF_NOSCRIPTSEL
Do not select a default script setting for the user.
CF_NOSIZESEL
Do not select a default point size for the user.
CF_NOSIMULATIONS
Do not display a sample of the selected font.
CF_NOSTYLESEL
Do not select a default style for the user.
CF_NOVECTORFONTS
Do not list vector fonts.
CF_NOVERTFONTS
Do not list vertically-oriented fonts.
CF_PRINTERFONTS
List printer fonts.
CF_SCALABLEONLY
Only list scalable fonts.
CF_SCREENFONTS
List screen fonts.
CF_SCRIPTSONLY
List all fonts using a Windows or Unicode character set.
CF_SELECTSCRIPT
Only list fonts with the proper character set.
CF_SHOWHELP
Display the Help button.
CF_TTONLY
Only list TrueType fonts.
CF_USESTYLE
Use information in lpStyle to initialize the dialog box.
CF_WYSIWYG
List only fonts common to the printer and the screen (must be used with CF_BOTH and CF_SCALABLEONLY).
rgbColors
The RGB value for the color of the font.
lCustData
An application-defined parameter to pass to the hook function specified by lpfnHook.
lpfnHook
A pointer to a CFHookProc hook function used to process the dialog box's messages, if needed.
lpTemplateName
The name of the dialog box template to use, if needed.
hInstance
A handle to the instance of the program that contains the pre-loaded dialog box template to use, if needed.
lpszStyle
Receives a string specifying the selected font's style settings. If used, this string must be large enough to receive the returned string.
nFontType
One or more of the following flags specifying the type of font that is selected:
BOLD_FONTTYPE
Boldface font.
ITALIC_FONTTYPE
Italicized font.
PRINTER_FONTTYPE
Printer font.
REGULAR_FONTTYPE
Regular font -- i.e., not boldface.
SCREEN_FONTTYPE
Screen font.
SIMULATED_FONTTYPE
Font that can be simulated in the dialog box.
MISSING_ALIGNMENT
Never set this variable. It is there only to align the other members of the structure in memory.
nSizeMin
The minimum allowable point size selection, if applicable.
nSizeMax
The maximum allowable point size selection, if applicable.

Constant Definitions

Const CF_ANSIONLY = &H400
Const CF_APPLY = &H200
Const CF_BOTH = &H3
Const CF_EFFECTS = &H100
Const CF_ENABLEHOOK = &H8
Const CF_ENABLETEMPLATE = &H10
Const CF_ENABLETEMPLATEHANDLE = &H20
Const CF_FIXEDPITCHONLY = &H4000
Const CF_FORCEFONTEXIST = &H10000
Const CF_INITTOLOGFONTSTRUCT = &H40
Const CF_LIMITSIZE = &H2000
Const CF_NOOEMFONTS = &H800
Const CF_NOFACESEL = &H80000
Const CF_NOSCRIPTSEL = &H800000
Const CF_NOSIZESEL = &H200000
Const CF_NOSIMULATIONS = &H1000
Const CF_NOSTYLESEL = &H100000
Const CF_NOVECTORFONTS = &H800
Const CF_NOVERTFONTS = &H1000000
Const CF_PRINTERFONTS = &H2
Const CF_SCALABLEONLY = &H20000
Const CF_SCREENFONTS = &H1
Const CF_SCRIPTSONLY = &H400
Const CF_SELECTSCRIPT = &H400000
Const CF_SHOWHELP = &H4
Const CF_TTONLY = &H40000
Const CF_USESTYLE = &H80
Const CF_WYSIWYG = &H8000
Const BOLD_FONTTYPE = &H100
Const ITALIC_FONTTYPE = &:H200
Const PRINTER_FONTTYPE = &H4000
Const REGULAR_FONTTYPE = &H400
Const SCREEN_FONTTYPE = &H2000
Const SIMULATED_FONTTYPE = &H8000

Used By

ChooseFont

Go back to the alphabetical Structure listing.
Go back to the Reference section index.


Last Modified: August 19, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/c/choosefont_type.html