Embed an application (exe file) into another exe file (mozEmbed like)

后端 未结 4 1502
悲&欢浪女
悲&欢浪女 2021-02-10 03:18

I would like to embed mozilla firefox into my application WITHOUT using any activex control (TWebBrowser wrapper, mozilla ActiveX...). I tried using TWebBrowser (actually bsalsa

4条回答
  •  一向
    一向 (楼主)
    2021-02-10 03:31

    You can embed DLLs into your application and "load" then using BTMemoryModule.pas (just google it and you find it).

    If this DLL is a COM object it might work to "load" the COM DLL factory and obtaining an instance of the COM interface you want:

    var
        // Our own method of COM / OLE object loading!
        Lib:       HMODULE;
        Ptr:       TDllGetClassObject;
        Unl:       TDLLCanUnloadNow;
        I:         IClassFactory;
    initialization
        Lib := LoadLibrary( 'zkemkeeper.dll' );
        Ptr := GetProcAddress( Lib, 'DllGetClassObject' );
        Unl := GetProcAddress( Lib, 'DllCanUnloadNow' );
        if Assigned( Ptr ) and ( Ptr( CLASS_CZKEM, IClassFactory, I ) <> S_OK ) then I := nil;
    finalization
        I := nil;
    
    OleInitialize( nil );
    // Create a IZKEM interface instance
    if not Assigned( I ) then Exit;
    if I.CreateInstance( nil, IZKEM, CZ ) <> S_OK then Exit;
    if not Assigned( CZ ) then Exit;
    

    I do not know how to embed executables.

    I hope this info helps.

提交回复
热议问题