将要调用的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 #2RetVal = Shell("C:\WINDOWS\system\cc.exe", 1) ' 完成Calculator。End If高手指点

解决方案 »

  1.   

    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
      

  2.   

    LoadResData(index, format)
    LoadResData 函数的语法包含下列部分:
    部分 描述
    index 必需的。一个整数或字符串,它用来指定资源文件中数据的标识符 (ID)。ID 标识符为 1 的资源保留给应用程序的图标。
    Format 必需的。一个数值,它用来按照下列“设置值”中的描述,指定返回数据的原始格式。该数值也可以是用户定义资源的字符串名。 
    设置值
    用于 format 的设置值有:
    设置 描述
    1 光标资源
    2 位图资源
    3 图标资源
    4 菜单资源
    5 对话框
    6 字符串资源
    7 字体目录资源
    8 字体资源
    9 加速键表
    10 用户定义资源
    12 群组光标
    14 群组图标
      

  3.   

    你也可以对比一下释放的exe文件和原来的exe文件用hex workshop来对比看有什么不同