Re: Embedding a VB script in DLL
- From: mr_unreliable <kindlyReplyToNewsgroup@xxxxxxxxxxx>
- Date: Wed, 21 Feb 2007 12:27:02 -0500
hi heerthana_m,
There are a number of ways for you to "embed" some text
(like a script file) into a COM dll.
For one, you can just save it as a long string, like this:
sMyScript = "line one" & vbCrLf & "line two" & vbCrLf...
To execute this, write the string to disk, and then call
wscript/cscript to execute the file. Or, you could use
the "microsoft script control" in your dll to run the
script. If you use the M.S.C. you don't need to write
your script to disk, just feed it into the MSC and run it.
(Note that the MSC does not support the "WScript" object).
For another possibility, you could compile your script
into a (text) "resource", and add the "resource" to your
dll. To do that, you need a "resource compiler". If you
have a microsoft compiler, then you already have the ms
resource compiler, "rc.exe". If not, you can find other
resource compilers (free and for-sale) on the web. You
compile your resource, then compile the resource into
your dll, and then extract it at run time. If your dll
is written in vb, there are native methods for extracting
text from the resource area. If you are not coding your
dll in vb, then you could use an api to do it. At run
time, you extract your script from the dll resource area,
and then use either of the methods mentioned above (write
to disk, or use the script control).
If you are running your COM dll from a vbScript, then
there are other possibilities. For example, you could
use the "wsf" (xml) format, and include your script as
an xml resource. But still, you could use wscript/cscript
to run it, or use the script control.
I'm sure there are other possibilities, as other people
will join in here and explain.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
keerthana_m_2003@xxxxxxxxx wrote:
Hello ALl:.
I have one COM DLL and I need to execute a VB Script from a function
of this COM DLL.
How can I embed the VB Script within the DLL and execute it whenever
required?
Thanks,
Keerthana
- References:
- Embedding a VB script in DLL
- From: keerthana_m_2003
- Embedding a VB script in DLL
- Prev by Date: Re: ProgId and TypeLib puzzlement...
- Next by Date: Re: Best site to download scripts
- Previous by thread: Embedding a VB script in DLL
- Next by thread: Edit comment propery?
- Index(es):
Relevant Pages
|