找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 3933|回复: 1

【开源】将RES中的资源写到文件

[复制链接]

1214

主题

352

回帖

11

精华

管理员

菜鸟

积分
93755

贡献奖关注奖人气王精英奖乐于助人勋章

发表于 2009-9-3 21:01:24 | 显示全部楼层 |阅读模式
<font face="Verdana">'将资源写出到指定文件<br/>Function WriteToFile(资源标识, cFile As String)<br/>Dim Tmpfile() As Byte<br/>&nbsp;&nbsp;&nbsp; '将资源文件装入内存<br/>&nbsp;&nbsp;&nbsp; Tmpfile = LoadResData(资源标识, "CUSTOM")<br/>&nbsp;&nbsp;&nbsp; Open cFile For Binary As #1<br/>&nbsp;&nbsp;&nbsp; Put #1, , Tmpfile<br/>&nbsp;&nbsp;&nbsp; Close #1<br/>End Function</font><font face="Verdana">'将资源写出到指定文件</font>
【VB】QQ群:1422505加的请打上VB好友
【易语言】QQ群:9531809  或 177048
【FOXPRO】QQ群:6580324  或 33659603
【C/C++/VC】QQ群:3777552
【NiceBasic】QQ群:3703755

1214

主题

352

回帖

11

精华

管理员

菜鸟

积分
93755

贡献奖关注奖人气王精英奖乐于助人勋章

 楼主| 发表于 2009-9-3 22:15:35 | 显示全部楼层
<font face="Verdana">Function ParseResourceFile(ByVal FilePath As String, ByVal FileName As String, ByVal ResType As String, ByVal ResID As Integer, ByVal IfDeleteFile As Boolean) As Boolean<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Dim TempFile() As Byte<br/>&nbsp;&nbsp;&nbsp; Dim PathName As String<br/>&nbsp;&nbsp;&nbsp; Dim intFreeFile As Integer<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; If Right(FilePath, 1) &lt;&gt; "\" Then FilePath = FilePath + "\"<br/>&nbsp;&nbsp;&nbsp; PathName = FilePath + FileName<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; If Len(Dir(PathName)) Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If IfDeleteFile Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Kill PathName<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit Function<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; TempFile = LoadResData(ResID, ResType)<br/>&nbsp;&nbsp;&nbsp; intFreeFile = FreeFile()<br/>&nbsp;&nbsp;&nbsp; Open PathName For Binary Access Write As #intFreeFile<br/>&nbsp;&nbsp;&nbsp; Put #intFreeFile, , TempFile<br/>&nbsp;&nbsp;&nbsp; Close #intFreeFile<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Erase TempFile<br/>&nbsp;&nbsp;&nbsp; ParseResourceFile = True<br/>&nbsp;&nbsp;&nbsp; <br/>End Function</font>
【VB】QQ群:1422505加的请打上VB好友
【易语言】QQ群:9531809  或 177048
【FOXPRO】QQ群:6580324  或 33659603
【C/C++/VC】QQ群:3777552
【NiceBasic】QQ群:3703755
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

快速回复 返回顶部 返回列表