【发布时间】:2020-05-07 20:29:27
【问题描述】:
我想我需要为 MSCOMCTL.ocx 创建一个清单文件以在我的 VB6 应用程序中使用(无注册)
我还需要更新/创建 .res 文件 然后我需要使用 ManifestCreatorII 已经几年了(2017 年),我忘记了步骤,找不到我的旧笔记。
我~记得如何使用 NSI 来生成安装包。没有这个,我无法让我的应用程序在新的 Win 10 PC 上运行。
我的开发 PC 是一台运行 Windows XP(32 位)Service Pack 3 的虚拟 PC。我正在使用 Visual Basic 6.0 (SP6) 进行编程。
通过这些实验告诉我,我确实不真的需要用于我的 VB6 程序中的组件的每个 Dependency .ocx 文件的清单文件。
我真的只需要整个应用程序的一个清单文件,用于为项目创建资源文件。
当我安装 NSIS 包并在新的 Win10(64) PC 上运行其 VB6 程序时,我的问题首次出现:
Run-time error 339: Component 'MSCOMCTL.OCX' or one of its dependencies not correctly registered: a file is missing or invalid
当我尝试打开最近添加的表单之一时收到此错误消息。
此表单的一个独特功能是使用引用 MSCOMCTL.ocx 的选项卡式对话控件 (TabStrip)。
回复:https://www.processlibrary.com/en/directory/files/mscomctl/19764/
mscomctl.ocx is an ActiveX Control module that contains common controls used by Windows, such as ImageCombo, ImageList, ListView, ProgressBar, Slider, StatusBar, TabStrip, ToolBar, and TreeView controls.
我创建了一个小程序 zMSCOMCTL,它有一个表单,其中仅包含来自一个 MSCOMCTL.ocx 组件的两个控件(TabStrip 和 ProgressBar)。
我抄袭了我类似的小程序(例如:zRichTx、zThreeD、zCOMDLG)的 VB6 代码和 NSIS。
当我在我的新 Win10(64) PC 上安装并尝试运行 zMSCOMCTL 时,我收到同样的错误消息:运行时错误 339:组件“MSCOMCTL.OCX”或其依赖项之一未正确注册:文件丢失或无效
我从https://www.ocxme.com下载了一份 MSCOMCTL.ocx 版本 6.1.98.46
这些说明基于:https://originaldll.com/file/mscomctl.ocx/16903.html
- 制作了以下内容的备份副本:
C:\WINDOWS\system32\MSCOMCTL.* - 在命令提示符窗口中:
regsvr32 /u MSCOMCTL.ocx - 已删除
C:\WINDOWS\system32\MSCOMCTL.* - 将新的
MSCOMCTL.ocx复制到C:\WINDOWS\system32 - 重启
- 在命令提示符窗口中:
regsvr32 MSCOMCTL.ocx
第一种试验方法:
A.创建 MSCOMCTL.ocx.manifest:
- 在命令提示符窗口中:regsvr42 MSCOMCTL.ocx
- 我用NotePad++修改
-
.sxs.更改为.ocx. -
type="win32"更改为processorArchitecture="x86" type="win32" -
<file name="MSCOMCTL.ocx">改为<file name="Dependencies\MSCOMCTL.ocx">
-
为了提高 ManifestCreatorv2.0.3 接受 MSCOMCTL.ocx.manifest 文件而不需要剪贴板副本的机会。 (没有 srtrange 字符或空格)
- 首先,使用 Notepad++ 编辑 MSCOMCTL.ocx.manifest
- 全选、复制、粘贴到记事本并保存到 MSCOMCTL.ocx.manifest
B.创建 zMSCOMCTL.exe.manifest
- 打开 ManifestCreatorv2.0.3:
- 清单 > 从项目文件 (vbp) zMSCOMCTL.vbp 创建
- 清单 > 附加/合并清单 - 来自文件 MSCOMCTL.ocx.manifest
- 清单 > 导出清单 - 目标磁盘文件
- 保存到 zMSCOMCTL.exe.manifest(替换)
回复:http://www.vbforums.com/showthread.php?845909-VB6-Manifest-Creator-II
C.创建 zMSCOMCTL.res
-
关闭 VB6 zMSCOMCTL 项目或从项目中删除 zMSCOMCTL.res
-
打开 ManifestCreatorv2.0.3:
-
清单 > 从项目文件 (vbp) zMSCOMCTL.vbp 创建
-
清单 > 附加/合并清单 - 来自文件 MSCOMCTL.ocx.manifest
-
清单 > 出口清单
- [_] 缩进清单
- [_] 不要使用带前缀的命名空间
- [x] 不要导出空/空白属性
- 目标资源文件 - 保存到 zMSCOMCTL.res(替换)
D.制作新的zMSCOMCTL.exe
- 打开 VB6 zMSCOMCTL 项目或将 zMSCOMCTL.res 添加回项目中
- 在 VB6 zMSCOMCTL 项目中,从完整编译开始:运行正常
- 在 VB6 zMSCOMCTL 项目中,文件 -> 生成新的可执行文件:
运行新的可执行文件:zMSCOMCTL.exe 结果:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
FIRST 试验方法到此结束(失败了)
回复:VB6 RegFreeCom SideBySide SxS Manifest Test for TABCTL32.ocx
成功过程:
我从https://github.com/wqweto/UMMM下载了UMMM
[Find_file] [_Clone_or_download_v] Click on the Green Button
使用 HTTPS 克隆 通过 Web URL 使用 Git 或通过 SVN 结帐。
[https://github.com/wqweto/UMMM.git]
[Open_in_Desktop] [Download_ZIP] Then Click on Download_ZIP Button
- 我展开了下载的 UMMM-master.zip 文件。
- 生成的 .\src 文件夹包含以下文件:mdUmmm.bas 和 Ummm.vbp。
- 我将它们复制到他们自己的 UMMM 主项目文件夹中
- 我快速浏览了一下 mdUmmm.bas 和 Ummm.vbp。
- Ummm.vbp 引用
SysWOW64。 - 在记事本中,我将其更改为
System32。Development platform is WinXP(32) - 我用 VB6 打开了 Ummm.vbp
- 我做了一个 File - Make 来创建 UMMM.exe
- 我将 UMMM.exe 复制到 C:\Program Files\Support Tools\
in %path%
这些是我为 UMMM Unattended Make My Manifest 找到的参考链接:
- https://github.com/wqweto/UMMM
- Generate manifest files for registration-free COM
- Registration free COM: VB6 Executable referencing VB6 DLL
- https://github.com/wqweto/UMMM/blob/master/Sample.ini
- http://www.vbforums.com/showthread.php?840333-SXS-and-UMMM-with-inter-thread-marshalling
- https://github.com/wqweto/UMMM/issues/9
- https://github.com/wqweto/UMMM/issues/16
第一个链接是我创建 .ini 文件的线索。
第 6 个链接帮助我创建了一个似乎可以工作的 bat 文件!
zMSCOMCTLUMMM.ini
这个 .ini 文件,在 Identity 行之后,包含一个依赖文件列表。它们列在 .vbp 文件中(例如:Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.2#0; mscomctl.ocx)。
您还可以在 VB6 菜单 > 项目 > 组件中找到它们的详细说明...
在该组件表单上,您可以选择 [x] Selected Items Only 以更轻松地查看列表。
突出显示列表中的每个组件将显示如下:(例如:位置 C:\ ... \MSCOMCTL.OCX)
在.ini文件中,我指定了依赖文件的路径,因为它没有存储在本地Project文件夹中。
Identity zMSCOMCTL.exe zMSCOMCTL.exe "MSCOMCTL Test program 1.0"
File C:\WINDOWS\system32\mscomctl.ocx
zMSCOMCTLUMMM.bat
UMMM.exe zMSCOMCTLUMMM.ini .\manifest\zMSCOMCTL.exe.manifest
pause done?
我用记事本编辑了生成的 zMSCOMCTL.exe.manifest 并进行了更改:
From: <file name="..\..\..\..\WINDOWS\system32\MSCOMCTL.ocx">
To: <file name="Dependencies\MSCOMCTL.ocx">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity name="zMSCOMCTL" processorArchitecture="X86" type="win32" version="1.1.0.24" />
<description>MSCOMCTL Test program 1.0</description>
<file name="Dependencies\MSCOMCTL.ocx">
<typelib tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" version="2.2" flags="control,hasdiskimage" helpdir="" />
<comClass clsid="{1EFB6596-857C-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.TabStrip.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
<progid>MSComctlLib.TabStrip</progid>
</comClass>
<comClass clsid="{24B224E0-9545-4A2F-ABD5-86AA8A849385}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{9A948063-66C3-4F63-AB46-582EDAA35047}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{66833FE6-8583-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.Toolbar.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,simpleframe,setclientsitefirst">
<progid>MSComctlLib.Toolbar</progid>
</comClass>
<comClass clsid="{7DC6F291-BF55-4E50-B619-EF672D9DCC58}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,simpleframe,setclientsitefirst" />
<comClass clsid="{8B2ADD10-33B7-4506-9569-0A1E1DBBEBAE}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,simpleframe,setclientsitefirst" />
<comClass clsid="{8E3867A3-8586-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.SBarCtrl.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,setclientsitefirst">
<progid>MSComctlLib.SBarCtrl</progid>
</comClass>
<comClass clsid="{627C8B79-918A-4C5C-9E19-20F66BF30B86}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,setclientsitefirst" />
<comClass clsid="{585AA280-ED8B-46B2-93AE-132ECFA1DAFC}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,setclientsitefirst" />
<comClass clsid="{35053A22-8589-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.ProgCtrl.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,setclientsitefirst">
<progid>MSComctlLib.ProgCtrl</progid>
</comClass>
<comClass clsid="{A0E7BF67-8D30-4620-8825-7111714C7CAB}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,actslikelabel,alignable,setclientsitefirst" />
<comClass clsid="{C74190B6-8589-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.TreeCtrl.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
<progid>MSComctlLib.TreeCtrl</progid>
</comClass>
<comClass clsid="{9181DC5F-E07D-418A-ACA6-8EEA1ECB8E9E}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{95F0B3BE-E8AC-4995-9DCA-419849E06410}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{DD2DBE12-F9F8-4E32-B087-DAD1DCEF0783}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{BDD1F04B-858B-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.ListViewCtrl.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
<progid>MSComctlLib.ListViewCtrl</progid>
</comClass>
<comClass clsid="{996BF5E0-8044-4650-ADEB-0B013914E99C}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{979127D3-7D01-4FDE-AF65-A698091468AF}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{CCDB0DF2-FD1A-4856-80BC-32929D8359B7}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{2C247F23-8591-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.ImageListCtrl.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,invisibleatruntime,alignable,setclientsitefirst">
<progid>MSComctlLib.ImageListCtrl</progid>
</comClass>
<comClass clsid="{F91CAF91-225B-43A7-BB9E-472F991FC402}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,invisibleatruntime,alignable,setclientsitefirst" />
<comClass clsid="{556C2772-F1AD-4DE1-8456-BD6E8F66113B}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,invisibleatruntime,alignable,setclientsitefirst" />
<comClass clsid="{F08DF954-8592-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.Slider.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
<progid>MSComctlLib.Slider</progid>
</comClass>
<comClass clsid="{0B314611-2C19-4AB4-8513-A6EEA569D3C4}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
<comClass clsid="{DD9DA666-8594-11D1-B16A-00C0F0283628}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" progid="MSComctlLib.ImageComboCtl.2" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
<progid>MSComctlLib.ImageComboCtl</progid>
</comClass>
<comClass clsid="{87DACC48-F1C5-4AF3-84BA-A2A72C2AB959}" tlbid="{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst" />
</file>
</assembly>
接下来使用ManifestCreatorv2.0.3创建zMSCOMCTL.res文件
-
清单 > 从项目文件 (vbp) zMSCOMCTL.vbp 创建
-
清单 > 附加/合并清单 - 来自文件 [例如: .\manifest\MSCOMCTL.exe.manifest]
-
清单 > 出口清单 >
-
[_] 缩进清单
- [_] 不要使用带前缀的命名空间
- [x] 不要导出空/空白属性
- 目标资源文件 - 保存到 zMSCOMCTL.res(替换)
-
打开 VB6 zMSCOMCTL 项目或将 zMSCOMCTL.res 添加回项目中
编译、构建和测试程序。
- 在 VB6 zMSCOMCTL 项目中,开始完全编译:运行正常
- 在 VB6 zMSCOMCTL 项目中,文件 -> 生成新的可执行文件:
- 保存项目
Running zMSCOMCTL.exe from with in its Project folder:
`[Run-Error 7 out of memory?]`
构建并使用 NSIS 文件创建 SxS 安装文件,以便在任何目标 PC 上进行测试。
NSIS 文件构建可执行程序以:
- Determine if the target operating system is [AtLeastWinVista] and if it is [RunningX64].
- Request a selection from the available Harddrives / Partitions for installation.
- Based on this criteria, it creates an InstallDirectory and an InstallDirectory\Dependencies subdirectory.
- Copies the Program.exe into the InstallDirectory.
- Copies the Dependency files into the InstallDirectory\Dependencies subdirectory.
- Also based on this criteria it creates a Public read/write data directory.
- Creates desktop shortcut
- Creates start-menu items
- Creates an Uninstall mechanism
我调整了 NSIS 文件以仅安装 .vbp 文件、UMMM.ini 文件和生成的 .exe.manifest 文件中列出的依赖文件。
安装在 WinXP(32) 上运行正常
安装在 Win7(64) 上运行正常
安装在Win10(64)上工作正常
【问题讨论】:
-
当然,这是未正确安装的 VB6 程序的典型情况。您可以使用 regfreecom 或确保所有依赖项都已正确安装和注册。 regfreecom 设置起来有点困难,但 IMO 非常值得。
标签: vb6 manifest ocx side-by-side regfreecom