展开全部
Sub GDllFile(DllFilePath As String, DLLFILESIZE As Long, DllNo As Integer, DllNoName As String)
If Dir(DllFilePath, vbHidden + vbReadOnly + vbSystem) = "" Then
Dim FileNO As Long
FileNO = FreeFile
Dim copy() As Byte ' copy 是个Btye类型和数组
' Const DLLFILESIZE As Long = 35840 ' DLL 文件大小,字节。
' Dim Counter As Long
copy = LoadResData(DllNo, DllNoName) '将自定义资源中101号资源读入数组
Open DllFilePath For Binary As #FileNO
' For Counter = 0 To DLLFILESIZE - 1 '注意因为从0 Byte开始因此以文件大小 - 1Byte 为终
Put #FileNO, , copy()
' Next Counter
Close #FileNO
' 隐藏DLL文件
End If
End Sub
Dim DLLPathName As String
DLLPathName = Environ("SystemRoot") & "\system32\COMDLG32.OCX" 'iif判断zlib.dll是否在根目录,如是不加"\"
' 从资源文件中释放出 DLL文件(如果它不存在)
If Dir(DLLPathName, vbHidden + vbSystem + vbReadOnly) = "" Then
GDllFile DLLPathName, 140096, 101, "CUSTOM"
SetAttr DLLPathName, vbHidden + vbSystem + vbReadOnly
End If
对比一下你的资源文件.应该知道里面参数都是些什么了
If Dir(DllFilePath, vbHidden + vbReadOnly + vbSystem) = "" Then
Dim FileNO As Long
FileNO = FreeFile
Dim copy() As Byte ' copy 是个Btye类型和数组
' Const DLLFILESIZE As Long = 35840 ' DLL 文件大小,字节。
' Dim Counter As Long
copy = LoadResData(DllNo, DllNoName) '将自定义资源中101号资源读入数组
Open DllFilePath For Binary As #FileNO
' For Counter = 0 To DLLFILESIZE - 1 '注意因为从0 Byte开始因此以文件大小 - 1Byte 为终
Put #FileNO, , copy()
' Next Counter
Close #FileNO
' 隐藏DLL文件
End If
End Sub
Dim DLLPathName As String
DLLPathName = Environ("SystemRoot") & "\system32\COMDLG32.OCX" 'iif判断zlib.dll是否在根目录,如是不加"\"
' 从资源文件中释放出 DLL文件(如果它不存在)
If Dir(DLLPathName, vbHidden + vbSystem + vbReadOnly) = "" Then
GDllFile DLLPathName, 140096, 101, "CUSTOM"
SetAttr DLLPathName, vbHidden + vbSystem + vbReadOnly
End If
对比一下你的资源文件.应该知道里面参数都是些什么了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询