| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 4 |
| 经验 | |
| 最后登录 | 2015-5-11 |
| 在线时间 | 1291 小时 |
- 梦石
- 0
- 星屑
- 407
- 在线时间
- 1291 小时
- 注册时间
- 2013-1-12
- 回帖
- 3349

|
发表于 2013-9-1 09:31:35
|
显示全部楼层
本帖最后由 76213585 于 2013-8-31 18:45 编辑
第二項應該可以通过判定資料夾內文件是否存在而來達成?
===========================
[pre lang="ruby" line="1"]dir = Win32API.new('kernel32','GetSystemDirectory','p,l','l')
dir_str = " " * 256
dir.call(dir_str,255)
dir_str = dir_str.split('system')[0]
font_name = "方正像素12.ttf"
font_chn_name = "方正像素12"
if FileTest.exist?(font_name)
copy = Win32API.new('kernel32',"CopyFileA",'p,p,l','')
copy.call(font_name, "#{dir_str}Fonts/#{font_name}",0)
font = Win32API.new('gdi32','AddFontResourceA','p','l')
sendmsg = Win32API.new('user32','SendMessageA','l,l,l,l','l')
unless Font.exist?("方正像素12") or Font.exist?(font_chn_name)
font.call(font_name)
sendmsg.call(65535,29,0,0)
#retry
end
end[/pre]
這个字体自動安裝腳本就是判定文件並且操作的 可能有用
@命真苦 |
|