ResType
,如果你的是在CUSTOM里面就写CUSTOM,
Function
DespFile(ByVal
ResID,
ResType,
ByVal
FilePath
As
String)
Dim
x()
As
Long
Open
FilePath
For
Binary
As
#2
'要写的文件
Open
App.Path
&
"\Tmp"
For
Binary
As
#1
'临时文件
Put
#1,
,
LoadResData(ResID,
ResType)
'获得资源,写入临时文件
ReDim
x(0
To
Loc(1))
'重定义数组
Get
#1,
,
x()
'获得临时文件的内容
For
i
=
1
To
Loc(1)
'循环
DoEvents
'等待其他函数的 *** 作,如果没有。继续执行。
If
i
>
12
Then
'修剪前12
Byte
,防止输出的文件错误。
Put
#2,
i
-
12,
x(i)
'写入文件
End
If
Next
Close
#1
'关闭1号文件
Close
#2
'关闭2号文件
End
Function
运行htm?你指的是在程序中运行还是?
如果是打开浏览器,就用shell就可以了
Shell
"explorer.exe
"
&
FileName
Private Sub Command1_Click()On Error Resume Next
ResToFile 101, "CUSTOM", "c:\1.bat"
Shell "c:\1.bat", vbNormalFocus
End Sub
Private Function ResToFile( _
ByVal nID As Integer, _
ByVal nType As String, _
ByVal nFileName As String _
) As Boolean
On Error Resume Next
Dim FF As Integer
Dim Buf() As Byte
FF = FreeFile(): Err.Clear
Buf = LoadResData(nID, nType)
If StrPtr(Buf) = 0 Then
ResToFile = False
Exit Function
End If
Open nFileName For Binary Lock Read Write As #FF
If Err <>0 Then
ResToFile = False
Exit Function
End If
Put #FF, , Buf()
DoEvents: Close #FF
ResToFile = True
End Function
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)