|
|
发表于 2011-10-24 13:13:45
|
显示全部楼层
本帖最后由 yipwing 于 2011-10-24 13:29 编辑
这个函数,俺还没用过。。。 以下是MSDN 网页版的。。
RemarksYou can provide a CFHookProc hook procedure for a Font dialog box. The hook procedure can process messages sent to the dialog box. To enable a hook procedure, set theCF_ENABLEHOOK flag in the Flags member of the CHOOSEFONT structure and specify the address of the hook procedure in the lpfnHook member.
以下是MSDN的例子:
- HWND hwnd; // owner window
- HDC hdc; // display device context of owner window
- CHOOSEFONT cf; // common dialog box structure
- static LOGFONT lf; // logical font structure
- static DWORD rgbCurrent; // current text color
- HFONT hfont, hfontPrev;
- DWORD rgbPrev;
- // Initialize CHOOSEFONT
- ZeroMemory(&cf, sizeof(cf));
- cf.lStructSize = sizeof (cf);
- cf.hwndOwner = hwnd;
- cf.lpLogFont = &lf;
- cf.rgbColors = rgbCurrent;
- cf.Flags = CF_SCREENFONTS | CF_EFFECTS;
- if (ChooseFont(&cf)==TRUE)
- {
- hfont = CreateFontIndirect(cf.lpLogFont);
- hfontPrev = SelectObject(hdc, hfont);
- rgbCurrent= cf.rgbColors;
- rgbPrev = SetTextColor(hdc, rgbCurrent);
- .
- .
- .
- }
复制代码
其实注意看remarks 里面的解释很充分了。。 |
|