Could Somebody Please Help Me!
Every Time I Open A New Font Dialog Box In My VB Program, I Get A 'You Have No Fonts Installed' Error, And I Have About 100 Fonts Installed, How Do I Make It Stop Doing That?
Printable View
Could Somebody Please Help Me!
Every Time I Open A New Font Dialog Box In My VB Program, I Get A 'You Have No Fonts Installed' Error, And I Have About 100 Fonts Installed, How Do I Make It Stop Doing That?
Did you remember to set the Flags? Try this example by making a Form with a CommonDialog and a CommandButton. Put this code into the CommandButton.
Code:Private Sub Command2_Click()
CommonDialog1.Flags = vbBoth
CommonDialog1.ShowFont
End Sub
If you don't want cto carry around with that horrible ocx you could use api instead:
Code:Type CHOOSEFONT
lStructSize As Long
hwndOwner As Long ' caller's window handle
hdc As Long ' printer DC/IC or NULL
lpLogFont As LOGFONT ' ptr. to a LOGFONT struct
iPointSize As Long ' 10 * size in points of selected font
flags As Long ' enum. type flags
rgbColors As Long ' returned text color
lCustData As Long ' data passed to hook fn.
lpfnHook As Long ' ptr. to hook function
lpTemplateName As String ' custom template name
hInstance As Long ' instance handle of.EXE that
' contains cust. dlg. template
lpszStyle As String ' return the style field here
' must be LF_FACESIZE or bigger
nFontType As Integer ' same value reported to the EnumFonts
' call back with the extra FONTTYPE_
' bits added
MISSING_ALIGNMENT As Integer
nSizeMin As Long ' minimum pt size allowed &
nSizeMax As Long ' max pt size allowed if
' CF_LIMITSIZE is used
End Type
Declare Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" (pChoosefont As CHOOSEFONT) As Long