利用AddFontResource给系统安装字体文件
By
admin
at 2020-08-06 • 0人收藏 • 1385人看过
好吧,看了网上的一些教程, 成功了?
如题:
//RUNAS// import console; import gdi import win.reg; import fsys; installFont = function(path){ var fontName = fsys.getFileName(path); var fontDescription = string.left(fontName,-5); var fontReg = win.reg("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"); fsys.copy(path,fsys.getSpecial(0x14/*_CSIDL_FONTS*/)); ::Gdi32.AddFontResource( fsys.getSpecial(0x14/*_CSIDL_FONTS*/) ++ "\" ++ fontName ); fontReg.setSzValue(fontDescription,fontName); ::PostMessage( 0xFFFF/*_HWND_BROADCAST*/,0x1D/*_WM_FONTCHANGE*/,0,0); } installFont("C:\Users\Administrator\Desktop\music\庞门正道粗书体.ttf"); console.pause(true);
登录后方可回帖