产品类库

当前位置:首页>产品类库

绿化清单生成ManifestBuilder

时间:2026-03-18   访问量:0

一、类库简介

    针对ActiveX DLL和ActiveX OCX,使用本类库可以给调用这些COM组件的EXE创建内置和外置manifest清单

    manifest清单可以用于替代注册表信息

    达到不注册到注册表在客户机上New对象的能力

    1、内置manifest的优先级高于外置manifest

    2、外置manifest命名  exe文件名.manifest

    3、在开发机上需要注册该DLL/OCX,发布到客户机后,不需要注册该DLL/OCX

二、类库特性

    1、COM方式和导出函数

    2、创建内置或外置manifest

    3、函数列表

    CreateManifest/MB_CreateManifest  创建一个新的Manifest文件/句柄

    AddXPStyle/MB_AddXPStyle 给exe指定XP视觉样式

    AddUAC/MB_AddUAC(blHighest) 添加管理员权限,参数False=requireAdministrator,参数True=highestAvailable

    AddDPI/MB_AddDPI  添加DPI自动适配特性

    AddCompatibility/MB_AddCompatibility  添加vista-win11兼容性特征

    AddCOM/MB_AddCOM((strFilePathPEorTLB As String, [RelativePath], [blInnerProxy As Boolean = True], [OutputType As Long = 2])) 核心方法,创建COM免注册信息

        必填参数:strFilePathPEorTLB:可以指定dll/ocx或者tlb,支持指定内置资源编号:c:\1.dll/1(表示1号资源)

        可选参数:RelavePath,用于且仅用于设置相对路径,例如/ocx/表示当前exe目录ocx子目录下,读取对应com文件

        可选参数:blInnerProxy,默认True,暂时没有研究出来进程外manifest的用法,所以本库暂时这个参数只能填True或者忽略这个参数

        可选参数:OutputType,输出颗粒度,0=仅coclass,1=coclass+事件接口,2=coclass和全部接口

    ReadManifest/MB_ReadManifest,从exe读取manifest字符串

    WriteManifest/MB_WriteManifest(strExeFilePath As String, [blWriteIn As Boolean = False]),输出manifest

        strExeFilePath:目标exe完整路径

        blWriteIn: 可选参数,是否写入exe内部,默认False

    ManifestString/MB_GetManifestString,获取执行到目前的当前manifest字符串

    WriteManifestFromFile/MB_WriteManifestFromFile(strExeFilePath As String, strManifestFilePath As String) 将已有manifest文件写入exe

    MB_ActiveManifest(hManifest As Long, pResult As Long),在当前进程中激活Manifest

        导出函数时执行hManifest句柄

        COM调用时,直接Active

Dim mb As New ManifestBuilder
mb.CreateManifest
mb.AddCOM "C:\MyApp\MyControl.ocx"

If mb.ActiveManifest Then  '手动激活manifest
    Dim obj As Object
    Set obj = CreateObject("MyControl.MyClass")  '这里createobject或者new在客户机上都是OK
    obj.DoSomething  '调用对象
End If


三、简单使用

Sub Main()
    'COM方式
    Dim m As ManifestBuilder
    Set m = New ManifestBuilder
    m.TLBReadingType = TLBReadingType_API
    m.CreateManifest
    m.AddDPI
    m.AddUAC True
    m.AddXPStyle
    m.AddCompatibility
    m.AddCOM "C:\Users\Administrator\Desktop\GoLib\dlls\EventApp\Ref\test\ocx\ocx\vbccr18.ocx", "ocx\ocx", True, 2
    m.WriteManifest "C:\Users\Administrator\Desktop\GoLib\dlls\EventApp\Ref\test\工程1.exe", True
    '导出函数方法
    'Dim h As Long
    'MB_CreateManifest h
    'MB_AddDPI h
    'MB_AddUAC h, 1
    'MB_AddXPStyle h
    'MB_AddCompatibility h
    'MB_AddCOM h, "C:\Users\Administrator\Desktop\GoLib\dlls\EventApp\Ref\test\ocx\ocx\vbccr18.ocx", "ocx\ocx", 1, 2
    'MB_WriteManifest h, "C:\Users\Administrator\Desktop\GoLib\dlls\EventApp\Ref\test\test_api_version.exe", 0
End Sub

四、下载地址

        跳转下载

上一页:EventApp后期绑定事件触发

下一页:Barcode 条码二维码组件

发表评论:

评论记录

暂无数据!