Re: In process/Out of process question




"Robin" <me@xxxxxxxxxxx> wrote in message
news:rask1218k6ifvte4u073q7qv3hvrg9ledm@xxxxxxxxxx

Below I give my understanding of various cases.. Please feel free
to make comments/corrections.

1) A class inside my own app

This of course runs in process. I have always used New to
instantiate, but can you use CreateObject in this?
And which is more efficient?


To use CreateObject, the class must be registered in the registry, with a path
to the providing app (identified in the registry as the InProcServer32), and a
class name of the form app.class, i.e. Excel.Sheet.8. So it won't really work
with a class defined in a standard exe, although it could if you made and
registered an ActiveX exe.


2) A component external to my app but residing on the same
computer.

a) An ActiveX DLL
Does this run in or out of process?
I can use both New (if reference is set) and CreateObject.
Which is more efficient in this case?

b) An ActiveX EXE
This has to be running out of process.
Does using New or CreateObject make any difference in
this case?


An ActiveX dll runs in process, while the ActiveX exe runs out of process. There
is little else to differentiate the two, except that an ActiveX exe can also be
run on its own (Excel is an ActiveX exe).

To load the reference, VB will end up looking in the registry anyway, so it
probably doesn't make much difference, except that it might have to look in the
registry only once to load a referenced component, but multiple times if you use
CreateObject for each object instance.


3) A component runnimg on a different computer, whether
a DLL or EXE

This also has to be out of process.
I think in this you have to use CreateObject, because you
have to specify the name of the computer where the
component resides.
Is it possible to use New in this?
And even if you could, does it make any difference?


I don't think you could use New anyway, and for a remote computer, the network
latency will vastly exceed any timing difference between New and CreateObject.


.



Relevant Pages

  • Re: VB making more threads than coded
    ... > issue when making new thread in an ActiveX exe using CreateObject() ... than the core runtime files), or anything else, and Task Manager might show ... the app having quite a few threads. ...
    (microsoft.public.vb.winapi)
  • Re: CreateObject via Class ID?
    ... The ActiveX Exe is trying to ... instantiate of its own classes via CreateObject so knowing the location of ... Mutex around the registry change and instantiation :-( ...
    (microsoft.public.vb.com)
  • Re: n-tier Architecture and IIS
    ... I tried to instantiate the object I created using CreateObject in ... another VB.NET app. ... I know it's registered in the registry, but I can't seem to get ...
    (microsoft.public.dotnet.framework)
  • Re: n-tier Architecture and IIS
    ... > another VB.NET app. ... I know it's registered in the registry, but I can't seem to get ... should use CreateObject only from non-.net COM clients. ...
    (microsoft.public.dotnet.framework)
  • Re: DLL Heck
    ... My ActiveX EXE talks to a manufacturer's M.DLL that does not return the correct result when the ActiveX EXE is referenced/used as a .EXE but does return the correct result when the ActiveX EXE is referenced/running in the IDE. ... how is a registered vs non-registered M.DLL different except for a reference in the registry. ... Does an attempt to register this .DLL create problems. ...
    (microsoft.public.vb.general.discussion)