Windows won't let you create a COm object from anything but an executablee
file - in principle, you could map the resource memory with the "executable"
attribute, fix up all the memory references, then execute it. That's what
the Windows loaders does, and it is as low level as it gets.
I can't imagine the code to extract an OCX to a temp folder, register it,
use, then unregister and delete will take more than 100 lines of fairly
trivial code.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by WhomeThx, I will look at this approach. I found few links about using it (vb,
but should be quite easy to port Delphi).
http://www.answers.com/topic/dllregisterserver
http://www.answers.com/topic/register-server
http://www.answers.com/topic/register-server-2
f-in-box.com site states they can use FlashOCX _directly_ from the
resource stream. I don't know if they do similar tempfile trick and
unregister later.
They do say, that if system already has a registered FlashOCX component
then use it.
Or is it possible to fool windows to load .dll binary from the
memorystream. This is what Java classloaders abstract nice and clean, but
probably same is not possible in Windows world.
Post by Dmitry StreblechenkoYou won't be able to use directly, at least not without a lot of hacking.
Why not extract it to a temporary directory and register it by using
DllRegisterServer exported function, use it, then uninstall it
(DllUnregisterServer) and then delete the file?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by WhomeTrue, adding resources in an exe is easy. Second link provides an
example how to do it.
BUT: I dont know how to use that embedded OCX component directly without
actually registering it to the windows system beforehand. This is what
first link describes and I think it is a nice trick.
Is there a common practice how to _instantiate_ OCX component directly
from the resource stream, and then use it as a normal ocx instance found
in a system?
If I embed ShockwaveOCX and then try to use it in my Delphi application,
it does not work...because its not registered in the system with
regserv32.exe tool or web plugin installer previously.
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html
http://www.delphiflash.com/codelib.php#a2
Post by Dmitry StreblechenkoYou can embed anything your want as a resource in an exe (or dll) file. Be
that an OCX or a Word file. What you do with that resource is up to you.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Post by WhomeSee this, they have a technique to load FlashOCX from exe file embedded
as a resource. They even can use it as a stream so no need to "save to
win/sys/flash.ocx, shellexecute regsrv32.exe flash.ocx" method.
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html
http://www.delphiflash.com/codelib.php#a2
What is this nice technique behind a stream-based ocx instantiation?
Is is something that could work with any ocx component, such as
ShockwaveOCX?