我想在我的系统中安装一种新字体,但我的代码有问题,我找不到我犯了什么错误。在我调用 CopyFile 后,该文件不存在于 C:\Windows\Fonts.Can你给我一些建议?谢谢。这是我的代码:
`//the source file
string sSourceDir = "F:\\my_job\\font\\";
//the file name
string sFontFileName = "jdqw.TTF";
string sFontName = "jdqw";
TCHAR sWinDir[MAX_PATH];
GetWindowsDirectory(sWinDir, MAX_PATH);
string sFontDir(sWinDir);
//make the path like C:\\Windows\\Fonts
sFontDir += "\\Fonts\\";
string sFOTFile = sFontDir;
sFOTFile += sFontFileName.substr(0, sFontFileName.length() - 4);
sFOTFile += ".FOT";
string source = sSourceDir;
string dest = sFontDir;
source += sFontFileName;
dest += sFontFileName;
//copy file
cout << source.c_str() << " " << dest.c_str() << endl;
cout << CopyFile(source.c_str(), dest.c_str(), FALSE) << endl;
cout << GetLastError() << endl;`