Windows Font Selector

Started by docroger, February 09, 2026, 06:20:00 AM

Previous topic - Next topic

docroger

Hello José,

How can i have the font selector (aka display font in powerbasic)?
Dont find any example with afxnova.

Thanx for any help.

José Roca

It doesn't need a wrapper. Fill a CHOOSEFONTW structure and call the ChooseFontW function.

type tagCHOOSEFONTW
lStructSize as DWORD
hwndOwner as HWND
hDC as HDC
lpLogFont as LPLOGFONTW
iPointSize as INT_
Flags as DWORD
rgbColors as COLORREF
lCustData as LPARAM
lpfnHook as LPCFHOOKPROC
lpTemplateName as LPCWSTR
hInstance as HINSTANCE
lpszStyle as LPWSTR
nFontType as WORD
___MISSING_ALIGNMENT__ as WORD
nSizeMin as INT_
nSizeMax as INT_
end type
#else
type tagCHOOSEFONTW field = 1
lStructSize as DWORD
hwndOwner as HWND
hDC as HDC
lpLogFont as LPLOGFONTW
iPointSize as INT_
Flags as DWORD
rgbColors as COLORREF
lCustData as LPARAM
lpfnHook as LPCFHOOKPROC
lpTemplateName as LPCWSTR
hInstance as HINSTANCE
lpszStyle as LPWSTR
nFontType as WORD
___MISSING_ALIGNMENT__ as WORD
nSizeMin as INT_
nSizeMax as INT_
end type
#endif

type CHOOSEFONTW as tagCHOOSEFONTW
type LPCHOOSEFONTW as tagCHOOSEFONTW ptr

declare function ChooseFontW(byval as LPCHOOSEFONTW) as WINBOOL

José Roca