Board index » delphi » 216 run time error

216 run time error

I have the following situation:
My client application talks with a DLL (this DLL know how to comunicate
with the server application: DCOM, CORBA, TCP/IP or LOCAL). In the
server side, I have two another EXE files: one to comunicate (the same
as the DLL) and the server application (my business rules).
Then, the client side doesn't need to know now to comunicate with the
server side. It only creates the object and the DLL knows where it will
get the object.

My CoClass has two or more interfaces.

When I create the COM object with the CoClass.Create method, I can only
create the default interface, then I create my interfaces with IUnknown,
and then with _QueryInterface. I also use _AddRef and _Release, to
increment and decrement the "client counter" of the server application.

The other way, creating my object with CreateRemoteCOMObject, everything
works fine (as good as the previous way).

However, when I close my application (with both creating ways), I get
the run time 216 error.

I have Delphi 3. I'm not using IE, my applications are .EXE files

My question is: Does the versions 3.01 or 3.02
corrected this problem? What's the problem?

Thanks

Eduardo Fendrich
eduar...@aol.com.br

 

Re:216 run time error


I've heard that Delphi 3.02 corrects this problem for some people.  I'm
running 3.02 and do not have the problem (any more).

Re:216 run time error


Eduardo A. Fendrich <eduar...@aol.com.br> wrote...

[details snipped]

Quote
> However, when I close my application (with both creating ways), I
> get the run time 216 error.

I just solved a similar 216 on shutdown error. It was due to a call to
OleUninitialize in a finalization section. The docs say that if
OleInitialize returns S_OK or S_FALSE you should call OleUninitialize. Well
I can say that if you do that in an ActiveX control library you will get
216 errors on shutdown (not all the time, but enough to be a problem). Only
call OleUninitialize if OleInitialize returns S_OK. The dirty hack would be
to not call OleUnitialize at all - that works fine too but may leak
something, don't know for sure.

--
Tim Knipe

Re:216 run time error


Try adding Sharemem to the uses clause of the Automation Server project
File.   I had kinda same problem and it is fixed by only adding Sharemem to
the Project File's uses clause...... lemme know about it..

Quote
Eduardo A. Fendrich wrote in message <34CF1E02.5...@aol.com.br>...
>I have the following situation:
>My client application talks with a DLL (this DLL know how to comunicate
>with the server application: DCOM, CORBA, TCP/IP or LOCAL). In the
>server side, I have two another EXE files: one to comunicate (the same
>as the DLL) and the server application (my business rules).
>Then, the client side doesn't need to know now to comunicate with the
>server side. It only creates the object and the DLL knows where it will
>get the object.

>My CoClass has two or more interfaces.

>When I create the COM object with the CoClass.Create method, I can only
>create the default interface, then I create my interfaces with IUnknown,
>and then with _QueryInterface. I also use _AddRef and _Release, to
>increment and decrement the "client counter" of the server application.

>The other way, creating my object with CreateRemoteCOMObject, everything
>works fine (as good as the previous way).

>However, when I close my application (with both creating ways), I get
>the run time 216 error.

>I have Delphi 3. I'm not using IE, my applications are .EXE files

>My question is: Does the versions 3.01 or 3.02
>corrected this problem? What's the problem?

>Thanks

>Eduardo Fendrich
>eduar...@aol.com.br

Re:216 run time error


Quote
Eduardo A. Fendrich wrote:
> However, when I close my application (with both creating ways), I get
> the run time 216 error.

Look at exception ...I had one similar problem and figured out (it tooks me
serveral hours ;-)):

In my client it was an exception (of a lost ODBC connection ) fired when an
object (inside a ComServer) was freed. So I changed the code from

    myObject.Free

to

    try
        myObject.Free
    except
        //no exception handling here 'cause we're dying ...
    end;

and everything worked well ...

Quote
> I have Delphi 3. I'm not using IE, my applications are .EXE files

> My question is: Does the versions 3.01 or 3.02
> corrected this problem? What's the problem?

No !

Quote
> Thanks

> Eduardo Fendrich
> eduar...@aol.com.br

Greeting from cologne

    Chris
--
Chris Gnther
chr...@netcologne.de / g...@ifacs.de

Other Threads