Creating unregistered objects in IDispatch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating unregistered objects in IDispatch

Ted Bracht-2
Hi,

I'm (still) trying to talk to a Java class, and get the impression that I'm
getting closer and closer, however, still not there.

I'm looking for something similar to IDispatch>>createObject:, but this only
works for registered objects. With ActiveX objects it should also be
possible to get a handle to an unregistered object. VB makes the distinction
CreateObject() and GetObject(), where the first does the same as
IDispatch>>createObject:, and the second allows unregistered objects. Is
there something like the GetObject() in Dolphin 4, if not, could somebody
put me in the right direction to build something like that myself?

Thanks,

Ted


Reply | Threaded
Open this post in threaded view
|

Re: Creating unregistered objects in IDispatch

Bill Schwab-2
Ted,

> I'm looking for something similar to IDispatch>>createObject:, but this
only
> works for registered objects. With ActiveX objects it should also be
> possible to get a handle to an unregistered object. VB makes the
distinction
> CreateObject() and GetObject(), where the first does the same as
> IDispatch>>createObject:, and the second allows unregistered objects. Is
> there something like the GetObject() in Dolphin 4, if not, could somebody
> put me in the right direction to build something like that myself?

Have a look at IDispatch class>example2 - it uses a CLSID to create an
object, which _might_ be helpful to you.  Also, a quick look at
#createObject: suggests that it might be willing to accept a CLSID in string
form rather than a progID.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Creating unregistered objects in IDispatch

Blair McGlashan
In reply to this post by Ted Bracht-2
Ted

You wrote in message news:90llat$1fcva$[hidden email]...
> ...
> I'm (still) trying to talk to a Java class, and get the impression that
I'm
> getting closer and closer, however, still not there.
>
> I'm looking for something similar to IDispatch>>createObject:, but this
only
> works for registered objects. With ActiveX objects it should also be
> possible to get a handle to an unregistered object. VB makes the
distinction
> CreateObject() and GetObject(), where the first does the same as
> IDispatch>>createObject:, and the second allows unregistered objects. Is
> there something like the GetObject() in Dolphin 4, if not, could somebody
> put me in the right direction to build something like that myself?

I'm not a VB expert, but I don't think that is quite correct. GetObject() is
like CreateObject() except that may (depending on parameters) first look in
the ROT (Running Object Table) to see if an existing instance of the object
has registered itself as running. Generally speaking COM objects must always
be registered in the registry in they are to be instantiable. One can use
[Co]GetObject() to pick up an existing instance that has been deliberately
registered in the running object table (e.g. an open word document).

Regardless, GetObject() is actually a wrapper around CoGetObject(), which is
very easy to call from Dolphin, especially as one can pass NULL for the
second (BIND_OPTS) argument. Note that the first argument to GetObject() in
VB is actually a moniker (well the string representation of such), which
corresponds to the first argument to CoGetObject(). The second argument to
GetObject() is the prog Id of the COMponent to create if the first argument
is an empty string, and that COMponent must be registered in the normal way.
Careful reading of the VB help is necessary as GetObject() is one of those
typical Microsoft functions that does many subtly different things.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Creating unregistered objects in IDispatch

Ted Bracht-2
In reply to this post by Bill Schwab-2
Hi Bill,

"Bill Schwab" <[hidden email]> wrote in message
news:90m39t$1l4b3$[hidden email]...

> Ted,
>
> > I'm looking for something similar to IDispatch>>createObject:, but this
> only
> > works for registered objects. With ActiveX objects it should also be
> > possible to get a handle to an unregistered object. VB makes the
> distinction
> > CreateObject() and GetObject(), where the first does the same as
> > IDispatch>>createObject:, and the second allows unregistered objects. Is
> > there something like the GetObject() in Dolphin 4, if not, could
somebody
> > put me in the right direction to build something like that myself?
>
> Have a look at IDispatch class>example2 - it uses a CLSID to create an
> object, which _might_ be helpful to you.  Also, a quick look at
> #createObject: suggests that it might be willing to accept a CLSID in
string
> form rather than a progID.
>

Thanks for your replu, unfortunately this example also only works if the
text-to-speech control is registered. If the CLSID is not registered, then
IDispatch can't instantiate.



> Have a good one,
>
> Bill
>
> --
> Wilhelm K. Schwab, Ph.D.
> [hidden email]
>
>

Ted

>


Reply | Threaded
Open this post in threaded view
|

Re: Creating unregistered objects in IDispatch

Ted Bracht-2
In reply to this post by Blair McGlashan
Hi Blair,

"Blair McGlashan" <[hidden email]> wrote in message
news:90nnue$1occq$[hidden email]...
>
> I'm not a VB expert, but I don't think that is quite correct. GetObject()
is
> like CreateObject() except that may (depending on parameters) first look
in
> the ROT (Running Object Table) to see if an existing instance of the
object
> has registered itself as running. Generally speaking COM objects must
always
> be registered in the registry in they are to be instantiable. One can use
> [Co]GetObject() to pick up an existing instance that has been deliberately
> registered in the running object table (e.g. an open word document).
>
> Regardless, GetObject() is actually a wrapper around CoGetObject(), which
is
> very easy to call from Dolphin, especially as one can pass NULL for the
> second (BIND_OPTS) argument. Note that the first argument to GetObject()
in
> VB is actually a moniker (well the string representation of such), which
> corresponds to the first argument to CoGetObject(). The second argument to
> GetObject() is the prog Id of the COMponent to create if the first
argument
> is an empty string, and that COMponent must be registered in the normal
way.
> Careful reading of the VB help is necessary as GetObject() is one of those
> typical Microsoft functions that does many subtly different things.
>

I couldn't find any method in Dolphin that contains the CoGetObject()
function. I suspect it should be added to the OLELibrary? This is all
getting way above my head. Can you suggest any understandable reading on
this subject that would get me any further?

Thanks,

> Regards
>
> Blair
>
>

Ted