Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11276

Re: Loading an un-registered object ?

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Loading an un-registered object ?
Date 2016-04-20 09:08 -0400
Organization A noiseless patient Spider
Message-ID <nf7usv$lu1$1@dont-email.me> (permalink)
References <57175fb9$0$5916$e4fe514c@news.xs4all.nl>

Show all headers | View raw


| I would like to be able to load/access and unregistered object into either 
a
| w- or cscript environment.   Some googeling in that regard returned
| "GetObject", but no matter what I try I can't get it to work.
|
| I tried :
|
| GetObject("MyObject.dll")
|
| GetObject("MyObject.dll","MyObject.foobar")
|
| wscript.GetObject("MyObject.dll")
|
| wscript.GetObject("MyObject.dll","MyObject.foobar")
|
| All of the above just throw an error, appearantly long before the
| "MyObject.dll" is even loaded (I've put a debugging statement in the DLL's
| initialisation code, and have not seen it).
|
| Any ideas ?
|

    There are several variants of GetObject, but none
of them can load an unregistered server. There's a lot
of work going on behind the scenes to load the library
and map out the functions so that VBS can access
them. WScript needs the typelib to do that.

  It's possible to load an unregistered server through
compiled code. I use a small tool in VB6, directCOM.dll,
to load my own Ax DLLs without reg. It's a free DLL
written by Olaf Schmidt. You could maybe create a
wrapper executable for that, but that would be getting
messy and reckless because you wouldn't have direct
control over your wrapper, unless you also register that.

  I don't know of any way to do what you want in VBS,
aside from writing involved command line functionality.

  What you may be finding with GetObject is reference
to the WScript.GetObject ability to create an object
based on a file, which is pretty much useless. It only
works for HTML, MS Office files if MS Office is installed,
etc. In other words, if you can access the file as an
object through a COM server then GetObject can save
you the step of creating the server explicitly. Whoopee.

Set Doc = WScript.GetObject("C:\Windows\Desktop\somefile.html")
MsgBox typename(Doc)
Set Bod = Doc.body
MsgBox Bod.innerText
Set Bod = Nothing
Set Doc = Nothing

Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-20 12:54 +0200
  Re: Loading an un-registered object ? "Mayayana" <mayayana@invalid.nospam> - 2016-04-20 09:08 -0400
    Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-20 16:04 +0200
      Re: Loading an un-registered object ? "Mayayana" <mayayana@invalid.nospam> - 2016-04-20 11:14 -0400
        Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-20 21:35 +0200
        Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-21 09:33 +0200
    Re: Loading an un-registered object ? GS <gs@v.invalid> - 2016-04-20 10:47 -0400
      Re: Loading an un-registered object ? "Mayayana" <mayayana@invalid.nospam> - 2016-04-20 11:25 -0400
        Re: Loading an un-registered object ? GS <gs@v.invalid> - 2016-04-20 14:31 -0400
        Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-20 21:59 +0200
          Re: Loading an un-registered object ? "Mayayana" <mayayana@invalid.nospam> - 2016-04-20 17:14 -0400
            Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-21 10:16 +0200
              Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-21 13:39 +0200
              Re: Loading an un-registered object ? "Mayayana" <mayayana@invalid.nospam> - 2016-04-21 09:49 -0400
                Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-21 17:07 +0200
      Re: Loading an un-registered object ? "R.Wieser" <address@not.available> - 2016-04-20 20:01 +0200

csiph-web