tags:

views:

111

answers:

2

I want to make a combo box with all of the computer's installed fonts enumerated in it. I'm not sure how this is done. Do I need to access the registry to get this? Thanks

+2  A: 

The winapi way of doing it is using EnumFontFamiliesEx function. You should pass a filled structure with default param DEFAULT_CHARSET to list all installed fonts.

See MSDN to get more information.

Kotti
Or `EnumFontFamilies` if you don't need all those "Ex" abilities...
Kotti
+5  A: 

You should use the Win32 API function EnumFontFamiliesEx. You call that function, passing a callback function matching the type of EnumFontFamExProc. The callback function is called once for every font found by EnumFontFamiliesEx.

I'd recommend using the unicode version (EnumFontFamiliesExW), as I've seen the ascii version (EnumFontFamiliesExA) display some very weird behaviour for East Asian language fonts.

The linked articles have example code.

Joe Gauterin