Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gdi32 and font list

Status
Not open for further replies.

DreXor

Programmer
Jun 17, 2003
2,224
US
i seem to have hit a road block in attempting to make a simple dll, i'm trying to retrieve all the installed system fonts and return them to a ADOR recordset or even an array for use in asp. The problem is all the sample code i've managed to find so far has been for listview or listboxes in applications w/ forms.

any recommendations on how to do this? i'm attempting to avoid using screen.fontcount ( because it's slow as molasses )

been attempting to do this with EnumFontFamilies but everything i've found so far requires a hDC

this is about the cleanest example i've found so far to work from :
Thanks in advance

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
 
Yes, they'll require a DC - but just send them the desktop DC if you really don't want to have a form involved. API call GetDC(0) is one way of achieving this
 
Quite so.

I just recall that VB5/6 documentation also demonstrate the use of EnumFontFamilies function as an application of the AddressOf operator.

See the example of AddressOf operator in your VB documentation or following link from MSDN VBA Reference.

AddressOf Operator Example

They also use the hDC of a form or control in above examples, but you can simply substitute GetDC(0) as strongm suggested.
 
ok and i'mn not trying to send it to a list box either and it seems to want to pipe this output to a listbox/listview form object. last part of the enumfontfam call

for the time being i've been using screen.fontcount but it's sloppy.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
 
using that last example here's this:
Code:
Sub FillListWithFonts(LB As ListBox)
Dim hDC As Long
[green]'    LB.Clear
'    hDC = GetDC(LB.hWnd)[/green]
    hDC = GetDC([red]0[/red])
    EnumFontFamilies hDC, vbNullString, AddressOf EnumFontFamProc, [b][blue]LB[/blue][/b]
    ReleaseDC [b][blue]LB.hWnd[/blue][/b], hDC
End Sub

how to elude the blue items, since the red was handled ok?

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top