• c++_获取系统安装字体


    //功能函数
    #include <vector>
    using namespace std;
    vector<CString> g_vSysFonts;
    INT CALLBACK NEnumFontNameProc(LOGFONT* plf, TEXTMETRIC* /*ptm*/, INT /*nFontType*/, LPARAM lParam/**/)
    {
        //同步调用的回调
        vector<CString>* sysFonts = (vector<CString>*)lParam;
        CString strVal(L"");
        if (sysFonts != NULL)
        {
            strVal = plf->lfFaceName;
            if (strVal.Left(1) != L"@")
            {
                sysFonts->push_back(strVal);
            }
        }
        return TRUE; //EnumFontFamilies 返回值由此回调返回决定
    }
    
    
    void GetSystemFont(HWND& hwnd)
    {
        vector<CString> vFont;
        HDC hdc = ::GetDC(hwnd);
    //    int nRet = ::EnumFontFamilies(hdc, (LPTSTR)NULL, (FONTENUMPROC)NEnumFontNameProc, (LPARAM) & (g_vSysFonts));
        int nRet = ::EnumFonts(hdc, (LPTSTR)NULL, (FONTENUMPROC)NEnumFontNameProc, (LPARAM) & (g_vSysFonts));
        ::ReleaseDC(hwnd, hdc);
    }
    // 调用函数
    GetSystemFont(m_hWnd);
        for (vector<CString>::iterator it = g_vSysFonts.begin();it!=g_vSysFonts.end();it++)
        {
            CString css = *it;
            if (css.MakeLower().Find(L"le")!=-1)
            {
                AfxMessageBox(css);
            }
        }
  • 相关阅读:
    jquery swipper插件的一些弊端
    linux ffmpeg 源码安装教程
    二叉树遍历(宽度优先)入门
    node安装教程
    Check the string CodeForces
    Minimize the error CodeForces
    sourcestress 问题解决方案
    C++ substr
    Java 读取Excel文件
    Stall Reservations
  • 原文地址:https://www.cnblogs.com/leochan007/p/14067559.html
Copyright © 2020-2023  润新知