问题 1
我用setup factory打包一个vb6.0做的程序,打包成功安装后在目录文件下发现文件同打包前没有任何改变,这是为什么?
问题 2
 上述文件安装在无vb的系统,提示某控件没有注册,为什么>
                                       谢谢!

解决方案 »

  1.   

    在你程序里写个注册控件的函数,代码如下,看看可不可以!Option ExplicitPrivate Declare Function LoadLibraryA Lib "kernel32" (ByVal lLibFileName As String) As Long
    Private Declare Function CreateThread Lib "kernel32" (lThreadAttributes As Any, ByVal lStackSize As Long, ByVal lStartAddress As Long, ByVal larameter As Long, ByVal lCreationFlags As Long, lThreadID As Long) As Long
    Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal lMilliseconds As Long) As Long
    Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lProcName As String) As Long
    Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
    Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Private Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lExitCode As Long) As Long
    Private Declare Sub ExitThread Lib "kernel32" (ByVal lExitCode As Long)
    'Purpose   :    This function registers and Unregisters OLE components
    'Inputs    :    sDllPath                        The path to the DLL/OCX
    '               bRegister                       If True Registers the control, else unregisters control
    'Outputs   :    Returns True if successful
    'Author    :    Andrewb
    'Date      :    04/09/2000
    'Notes     :    This effectively replaces RegSvr32.exe by loading the library and
    '               calling the register or unregister functions exposed by all OLE components.
    'Revisions :
    Function RegisterServer(ByVal sDllPath As String, Optional bRegister As Boolean = True) As Boolean
    Dim lLibAddress As Long, lProcAddress As Long, lThreadID As Long, lSuccess As Long, lExitCode As Long, lThread As Long
    Dim sRegister As String
    Const clMaxTimeWait As Long = 20000     'Wait 20 secs for register to
    complete
    On Error GoTo ExitFunc
    If Len(sDllPath) > 0 And Len(Dir(sDllPath)) > 0 Then
    'File exists
    If bRegister Then
    sRegister = "DllRegisterServer"
    Else
    sRegister = "DllUnregisterServer"
    End If
    'Load library into current process
    lLibAddress = LoadLibraryA(sDllPath)
    If lLibAddress Then
    'Get address of the DLL function
    lProcAddress = GetProcAddress(lLibAddress, sRegister)
    If lProcAddress Then
    'Found interface, make call to component
    lThread = CreateThread(ByVal 0&, 0&, ByVal lProcAddress, ByVal 0&, 0&, lThread)
    If lThread Then
    'Created thread
    lSuccess = (WaitForSingleObject(lThread, clMaxTimeWait) = 0)
    If Not lSuccess Then
    'Failed to register, close thread
    Call GetExitCodeThread(lThread, lExitCode)
    Call ExitThread(lExitCode)
    RegisterServer = False
    Else
    'Register control
    RegisterServer = True
    Call CloseHandle(lThread)
    End If
    End If
    Else
    'Object doesn't expose OLE interface
    FreeLibrary lLibAddress
    End If
    Call FreeLibrary(lLibAddress)
    End If
    End If
    ExitFunc:
    On Error GoTo 0
    End Function
      

  2.   

    你可以如下:
    1.你把你刚编译出来的exe和相关的资源文件复制到某一空目录下。
    2.用安装工具添加该目录(包含目录下的文件和子目录)。
    3.从 工具(T) 菜单选择 扫描VB工程... 然后指向你的vbp文件,让它扫描,他会把你引用的库和ocx也都加进来(你自己也要检察一下)。
    4.在左边的 运行时支持 功能那里, 把VB6给勾上。  然后其它的你就可以自己设置了。注意: 你在自己添加 dll或ocx文件时,在列表里对它按右键-属性,高级标签一定要勾 注册dll/ocx 选项。
      

  3.   

    你在自己添加 dll或ocx文件时,在列表里对它按右键-属性,高级标签一定要勾 注册dll/ocx 选项
      

  4.   

    出现这个问题的原因就是你没有把程序引用的一些空间打包进来,使用工具-〉扫描VB程序就可以把需要打包的ocx,dll文件添加进来了,然后再打包,安装。如果还有问题的话,最好在你的打包程序里面加上MDAC2.7的安装文件。