Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++;无法在Windows 10中安装字体 我有两个字体,它们是我的Windows C++应用程序(Ubuntu,Roopto Cube和Roboto Thin)使用的,我已经尝试用AddFontResource和AdfFutRoSoCeEX安装它们,但是它在Windows 10的最新版本版本中也不适用,也在Windows Server 2008和2012中不起作用。 未安装字体。所以我已经创建了我的字体安装C++类。 在我的C++/VSNET2015函数中,我做如下: 复制C:\Windows\Fonts中的.TTF字体文件 将.TTF字体文件添加到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts FontName(TrueType)-FontFile.TTF 调用AddFontResource(FontFileName) 发送WM_FONTCHANGE消息_C++_Windows_Fonts_Truetype - Fatal编程技术网

C++;无法在Windows 10中安装字体 我有两个字体,它们是我的Windows C++应用程序(Ubuntu,Roopto Cube和Roboto Thin)使用的,我已经尝试用AddFontResource和AdfFutRoSoCeEX安装它们,但是它在Windows 10的最新版本版本中也不适用,也在Windows Server 2008和2012中不起作用。 未安装字体。所以我已经创建了我的字体安装C++类。 在我的C++/VSNET2015函数中,我做如下: 复制C:\Windows\Fonts中的.TTF字体文件 将.TTF字体文件添加到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts FontName(TrueType)-FontFile.TTF 调用AddFontResource(FontFileName) 发送WM_FONTCHANGE消息

C++;无法在Windows 10中安装字体 我有两个字体,它们是我的Windows C++应用程序(Ubuntu,Roopto Cube和Roboto Thin)使用的,我已经尝试用AddFontResource和AdfFutRoSoCeEX安装它们,但是它在Windows 10的最新版本版本中也不适用,也在Windows Server 2008和2012中不起作用。 未安装字体。所以我已经创建了我的字体安装C++类。 在我的C++/VSNET2015函数中,我做如下: 复制C:\Windows\Fonts中的.TTF字体文件 将.TTF字体文件添加到HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts FontName(TrueType)-FontFile.TTF 调用AddFontResource(FontFileName) 发送WM_FONTCHANGE消息,c++,windows,fonts,truetype,C++,Windows,Fonts,Truetype,字体每次都会安装并运行,但在我重新启动Windows之前,字体都会运行,但不会。字体文件在那里,注册表项正常。字体也显示在Windows字体资源管理器中,但无法在我的应用程序中使用,并且无法从Windows字体资源管理器中删除字体,因为字体正在使用中(应用程序关闭时) 我使用以下参数调用函数 CInstallFont instFont; instFont.InstallFont(_T("Roboto Light"), _T("Roboto-Light.ttf")); instFont.Inst

字体每次都会安装并运行,但在我重新启动Windows之前,字体都会运行,但不会。字体文件在那里,注册表项正常。字体也显示在Windows字体资源管理器中,但无法在我的应用程序中使用,并且无法从Windows字体资源管理器中删除字体,因为字体正在使用中(应用程序关闭时)

我使用以下参数调用函数

CInstallFont instFont;

instFont.InstallFont(_T("Roboto Light"), _T("Roboto-Light.ttf"));
instFont.InstallFont(_T("Roboto Thin"), _T("Roboto-Thin.ttf"));
instFont.InstallFont(_T("Roboto Regular"), _T("Roboto-Regular.ttf"));

虽然这对你来说可能很明显,但对我来说却不是:你的问题是什么?我已经添加了一个问题,我想首先要问的更重要的问题是:“我的代码有什么问题吗?我已经验证了所有调用都成功了。”并附上一个。您刚刚得出的结论是,您的代码不可能是错误的,并且系统中必须内置一些保护。Protip:未经用户许可,不要在用户的计算机上安装字体。尤其是当你甚至不检查他们是否已经安装了这些字体,并且你的版本会更旧的时候。捆绑您的字体并从APPDATA目录加载资源,除非用户授予您在系统上安装字体的权限。未经用户许可,请勿在用户的计算机上安装字体。。。我赞成。听起来这些字体只在应用程序的GUI中使用,因此您应该在每次启动应用程序时使用
AddFontResourceEx(filePath,FR_PRIVATE,nullptr)
从应用程序文件夹中私下加载它们。FR_PRIVATE标志将对所有其他应用程序隐藏字体。
CInstallFont instFont;

instFont.InstallFont(_T("Roboto Light"), _T("Roboto-Light.ttf"));
instFont.InstallFont(_T("Roboto Thin"), _T("Roboto-Thin.ttf"));
instFont.InstallFont(_T("Roboto Regular"), _T("Roboto-Regular.ttf"));