这个问题不至于放这么多份吧
以下是我以前给这里的朋友写的一个文件
参考一下
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form FMain 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Release Dll Demo"
   ClientHeight    =   1935
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1935
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin MSComDlg.CommonDialog cd 
      Left            =   780
      Top             =   900
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdFile 
      Caption         =   "..."
      Height          =   315
      Left            =   4260
      TabIndex        =   2
      Top             =   315
      Width           =   315
   End
   Begin VB.TextBox txtFile 
      Height          =   315
      Left            =   165
      TabIndex        =   1
      Top             =   315
      Width           =   4080
   End
   Begin VB.CommandButton cmdRelease 
      Caption         =   "&Release Dll"
      Height          =   315
      Left            =   645
      TabIndex        =   0
      Top             =   1455
      Width           =   3225
   End
End
Attribute VB_Name = "FMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdFile_Click()
    Dim sFile As String
    With cd
        .Filter = "*.dll|*.dll;*.*|*.*"
        .ShowSave
        sFile = .FileName
    End With
    If Len(sFile) > 0 Then txtFile.Text = sFile: txtFile.SelStart = Len(sFile)
End SubPrivate Sub cmdRelease_Click()
    Dim abDll() As Byte, lCount As Long, lFile As Long, sFile As String
    sFile = txtFile.Text
    If Len(sFile) < 1 Then MsgBox "Please input output file name!": Exit Sub
    abDll = LoadResData("Balloon", "DLL")
    lCount = UBound(abDll)
    lFile = FreeFile
    On Error GoTo ErrRow
    Open sFile For Binary Access Write As lFile
    Put #lFile, , abDll
    Close lFile
    Do While Dir(sFile) = "": Loop
    MsgBox "File released!"
    Shell "regsvr32 " & """" & sFile & """"
    GoTo EndRow
ErrRow:
    MsgBox Err.Description
EndRow:
    
End SubPrivate Sub Form_Load()End Sub

解决方案 »

  1.   

    使用filesystemobject对象目录FileSystemObject.CopyFile 源目录, 新目录 
     
    文件
    FileSystemObject.CopyFile 源文件, 新文件以上都可使用*代替目录,文件或者
    FileCopy 源文件, 新文件     ' 将源文件的内容复制到目的文件中
      

  2.   

    我指的不是资源文件啊,是跟VB豪不相干的二进制文件。我做了一个VB程序,可是还要让VB程序在运行时生成一个二进制文件放入到指定的目录中。如果将这个二进制文件连同VB一起编译呢,各位大小虾求命啊