再线等快结--------vb释放资源后exe不能运行?
将要调用的exe资源打包后,释放出来不能正常运行?没有打包前可以单独的正常运行为什么呢?
Dim APP1() As Byte
If Dir("C:\WINDOWS\system\cc.exe") = "" Then
APP1 = LoadResData(101, "CUSTOM")
Open "C:\WINDOWS\system\cc.exe" For Binary As #2
Put #2, , APP1
Close #2
RetVal = Shell("C:\WINDOWS\system\cc.exe", 1) ' 完成Calculator。
End If
高手指点
[解决办法]
Public Function SaveFileFromRes(vntResourceID As Variant, sType As String, sFileName As String) As Boolean
Dim bytImage() As Byte ' Always store binary data in byte arrays!
Dim iFileNum As Integer 'Free File Handle
On Error GoTo SaveFileFromRes_Err
SaveFileFromRes = True
'Load Binary Data from Resource file
bytImage = LoadResData(vntResourceID, sType)
'Get Free File Handle
iFileNum = FreeFile
'Open the file and save the data
Open sFileName For Binary As iFileNum
Put #iFileNum, , bytImage
Close iFileNum
Exit Function
SaveFileFromRes_Err:
SaveFileFromRes = False: Exit Function
End Function
[解决办法]
你也可以对比一下释放的exe文件和原来的exe文件用hex workshop来对比看有什么不同
[解决办法]
学习