BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Load and use OCX from exe resource part and/or any TStream?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Whome
Guest





PostPosted: Wed Aug 30, 2006 8:12 am    Post subject: Load and use OCX from exe resource part and/or any TStream? Reply with quote



See 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.

FlashOCX from stream at runtime:
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html

FlashOCX from resource and register with regsrv32.exe tool:
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?
Back to top
Dmitry Streblechenko
Guest





PostPosted: Thu Aug 31, 2006 10:32 pm    Post subject: Re: Load and use OCX from exe resource part and/or any TStre Reply with quote



You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f53977 (AT) newsgroups (DOT) borland.com...
Quote:
See 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.

FlashOCX from stream at runtime:
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html

FlashOCX from resource and register with regsrv32.exe tool:
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?
Back to top
Whome
Guest





PostPosted: Fri Sep 01, 2006 7:35 pm    Post subject: Re: Load and use OCX from exe resource part and/or any TStre Reply with quote



True, 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


Quote:
Dmitry Streblechenko wrote:
You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f53977 (AT) newsgroups (DOT) borland.com...
See 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.

FlashOCX from stream at runtime:
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html

FlashOCX from resource and register with regsrv32.exe tool:
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?
Back to top
Dmitry Streblechenko
Guest





PostPosted: Sat Sep 02, 2006 2:50 am    Post subject: Re: Load and use OCX from exe resource part and/or any TStre Reply with quote

You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f84542$1 (AT) newsgroups (DOT) borland.com...
Quote:
True, 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


Dmitry Streblechenko wrote:
You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f53977 (AT) newsgroups (DOT) borland.com...
See 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.

FlashOCX from stream at runtime:
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html

FlashOCX from resource and register with regsrv32.exe tool:
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?
Back to top
Whome
Guest





PostPosted: Sat Sep 02, 2006 8:21 pm    Post subject: Re: Load and use OCX from exe resource part and/or any TStre Reply with quote

Thx, 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.

Quote:
Dmitry Streblechenko wrote:
You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f84542$1 (AT) newsgroups (DOT) borland.com...
True, 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


Dmitry Streblechenko wrote:
You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f53977 (AT) newsgroups (DOT) borland.com...
See 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.

FlashOCX from stream at runtime:
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html

FlashOCX from resource and register with regsrv32.exe tool:
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?
Back to top
Dmitry Streblechenko
Guest





PostPosted: Tue Sep 05, 2006 2:11 am    Post subject: Re: Load and use OCX from exe resource part and/or any TStre Reply with quote

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

"Whome" <nomail (AT) nomai (DOT) com> wrote in message
news:44f9a1ad (AT) newsgroups (DOT) borland.com...
Quote:
Thx, 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.

Dmitry Streblechenko wrote:
You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f84542$1 (AT) newsgroups (DOT) borland.com...
True, 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


Dmitry Streblechenko wrote:
You 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

"Whome" <nomail (AT) maildot (DOT) com> wrote in message
news:44f53977 (AT) newsgroups (DOT) borland.com...
See 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.

FlashOCX from stream at runtime:
http://www.f-in-box.com/delphi/help/index/how_to/loading_flash_ocx_code_from_stream.html

FlashOCX from resource and register with regsrv32.exe tool:
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?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.