VB中如何把资源管理器的文件释放出来
如VB中如何把资源器的文件释放出来,并且允许。。如把1.bat载入资源编辑器,为101.如何点击command1运行1.bat...
如 VB中如何把资源器的文件释放出来,并且允许。。如把1.bat载入资源编辑器,为101.如何点击command1运行1.bat
展开
展开全部
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
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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询