关于用ChooseFont(&CHOOSEFONT)对话框改变字体颜色的问题

部分代码如下:用settextcolor,无法改变字体颜色,求教大神,我在学windows程序设计,谢谢

GetObject(GetStockObject(SYSTEM_FONT),sizeof(lf),&lf);

    cf.lStructSize = sizeof(CHOOSEFONT);
    cf.hwndOwner = hwnd;
    cf.hDC = NULL;
    cf.lpLogFont = &lf;
    cf.iPointSize = 0;
    cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS;
    cf.rgbColors = 0;
    cf.lCustData = 0;
    cf.lpfnHook = NULL;
    cf.lpTemplateName = NULL;
    cf.hInstance = NULL;
    cf.lpszStyle = NULL;
    cf.nFontType = 0;
    cf.nSizeMax = 0;
    cf.nSizeMin = 0;

    hfont = CreateFontIndirect(&lf);
            SendMessage(hwndEdit, WM_SETFONT, (WPARAM)hfont, 0);

            GetClientRect(hwndEdit,&rect);
            InvalidateRect(hwnd,&rect,TRUE);
 CEdit * pEdit = (CEdit*) GetDlgItem(文本框id);
CDC * pdc = pEdit->GetDC();
pdc->SetTextColor(cf.rgbColors);

这在windows程序设计那个程序根本不是这样解决好吧,我还刚点一个无用竟然就有人点解决也是牛,不过我找到方法了,在message那加一个即可,顺便把cf生成全局静态变量即可


case WM_CTLCOLOREDIT:
        SetTextColor((HDC)wParam, cf.rgbColors);
        return 0;