News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Enumerate all fonts installed

Started by starzboy, December 17, 2008, 10:45:58 AM

Previous topic - Next topic

dedndave

well - that is important - and i forgot about it, too
but, the last attempt i looked at had some other problems
mainly, the enumerate call was in the message handler and called whenever there was no handled message
that function only needs to be called once, in this case
and, because you are trying to enumerate all fonts, it may take some time
i had a busy day today, so didn't get to play with it
perhaps tomorrow i'll give it a shot   :bg

Gunner

I found this rar (converted to zip just now) file on the net a long while ago (Took some time to find in all my files).  It enumerates all the installed fonts and loads up a combobox with the names...  You should be able to modify it to draw the font names in the font.

I might even try this  :bg
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

donkey

Just looked at this thread, the code snippet at the beginning was part of a demo available on my website to create a font menu, each font on the menu drawn in that font.

Font Menu

You might find it useful for some ideas.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

dedndave

both are good examples, guys   :U

xandaz

   yes dave. But you might have missed the face that the enum call is only made if ENUM_FLAG==FALSE. After the enumeration is done i set ENUM_FLAG to TRUE ( or some other value, it's irrelevant cause it only responds to false ), and, so, the call is only made once. Going to check gunner's example. Thanks

xandaz

   Gunner, tho the WM_DRAWITEM processing is not yet fine, the problems i'm dealing with , have to do with pointers. Mainly DRAWITEM.itemID, which is sent with LB_ADDSTRING as an ENUMLOGFONTEX stucture. The Font that is created dispite the itemID changes and the lfFaceName always seems to be the same. Don't know why but as dave would say.... : working on it. Thanks

xandaz

   The best that could be done for now. Nothing wrong with the pointers. Not sure why things go wrong with the listbox. I Could add a scroller if i knew how to process it. Thanks

xandaz

   Go it working with the listbox. It's not ready to process item selection or anything. It only draws items on creation so if you try it out try not to click the items. I noticed that sometimes it crashes so it needs some fixing. Thanks guys

xandaz

    I think that there might be some sort of problem with memory alloc/free because the program errors on exit. does anyone know why? Thanks

dedndave

could it be that you are missing a call to LocalUnlock ?

xandaz

   no... it has localunlock but maybe it aint working somehow, thanks and bye. working on it

dedndave

i suggest you double-check
it has LocalAlloc, LocalLock, and LocalFree
i don't see LocalUnlock
now, i am not sure that's the problem
but, it seems to me that the block cannot be freed unless the lock count is 0

easy enough to check
LocalFree should return EAX = 0

xandaz

   Maybe not on the one i posted. Right not on that one. The problem has to do with it. But it seems to work fine with LPTR flag on allocation and neither unlock ( which from what i've read doesn't work with LMEM_FIXED ) nor Freeing.

xandaz

   Final version yet to be released. LOL.

xandaz

  ooops. forgot to attach