| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1282 人关注过本帖
标题:我想问下·这是一个文件的释放·那么二个怎么写
只看楼主 加入收藏
WSZXD
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-6-27
结帖率:100%
收藏
 问题点数:0 回复次数:0 
我想问下·这是一个文件的释放·那么二个怎么写
我想问下·这是一个文件的释放·那么二个怎么写
Public Function ExtractFile(ResIndex As Integer, ResType As String)
 
    Dim TempFile() As Byte

    Dim FileHandle As Integer '定义文件句柄
   FileHandle = FreeFile '初始化文件句柄

    TempFile = LoadResData(ResIndex, ResType) '装载资源文件
   Open App.Path & "\q1.exe" For Binary Access Write As #FileHandle  '以二进制方式操作文件
   Put #FileHandle, , TempFile '写入文件
   Close #FileHandle '关闭文件句柄
End Function



Private Sub cmdRes_Click()
Dim n As Integer
n = 0
n = ExtractFile(101, "CUSTOM") '
Shell App.Path & "\q1.exe", vbNormalFocus

If (n <> 0) Then
   MsgBox "释放文件失败"
End If

End Sub

Private Sub Timer1_Timer()
On Error Resume Next
Kill "q1.exe"
End Sub
在写一遍吗

Public Function ExtractFile(ResIndex As Integer, ResType As String)
 
    Dim TempFile() As Byte

    Dim FileHandle As Integer '定义文件句柄
   FileHandle = FreeFile '初始化文件句柄

    TempFile = LoadResData(ResIndex, ResType) '装载资源文件
   Open App.Path & "\q1.exe" For Binary Access Write As #FileHandle  '以二进制方式操作文件
   Put #FileHandle, , TempFile '写入文件
   Close #FileHandle '关闭文件句柄
End Function



Private Sub cmdRes_Click()
Dim n As Integer
n = 0
n = ExtractFile(101, "CUSTOM") '
Shell App.Path & "\q1.exe", vbNormalFocus

If (n <> 0) Then
   MsgBox "释放文件失败"
End If

End Sub

Private Sub Timer1_Timer()
On Error Resume Next
Kill "q1.exe"
End Sub
搜索更多相关主题的帖子: Sub 句柄 Dim End 文件 
2020-01-06 22:38
快速回复:我想问下·这是一个文件的释放·那么二个怎么写
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016588 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved