🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7819

Re: Close Form in DLL

#7819
From: Remy Lebeau (TeamB)
Date: Tue, 21 Dec 2004 09:17
44 lines
2784 bytes
"KL Chin" <klchin@1asia.com.my> wrote in message
news:41c7b41a@newsgroups.borland.com...

> Sorry, I will not able to show the complete code, it was too big.

I don't want the complete code.  Only the parts that are relavant to this
discussion - the code involved in shutting down the DLL and application.

> BTW, not I wanted to access the DLL after it is freed. It was some
> how called during the unload/closing process and it was always had
> problem when Server issue a close command.

Then your shutdown code is faulty.  That is why I asked you to show it.

>                               PostMessage( Handle,WM_CLOSE,0,0 );
>                               PostMessage( Handle,WM_DESTROY,0,0 );

Do not destroy the Handle.  TForm will do that for you automatically when
appropriate.

> __declspec(dllexport) int WINAPI PluginExit( void )

When does the application call this?

>     if ( frMxCast )

Are you guaranteeing that the application never calls PluginExit() while the
form is in the process of closing itself?  If not, then you may have a
potential timing issue where frMxCast is not NULL yet but the form and
PluginExit() are both going to try to free the same memory multiple times.

> __declspec(dllexport) int WINAPI PluginInit( HWND hWnd,  viPluginInTInfo
> lpInTInfo )

When does the application call this?

Nothing in the code you have shown indicates where the actual error is
occuring.  But then, you did not show any of your application code at all,
either.  It is not very helpful to show the DLL code without showing the
application code that is calling the DLL code.


Gambit
Technical Details
Message-ID: <41c7e9f2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.netcologne.de!newsfeed-fusi.netcologne.de!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41c78d36@newsgroups.borland.com> <41c79929$3@newsgroups.borland.com> <41c7a03a@newsgroups.borland.com> <41c7a7df$1@newsgroups.borland.com> <41c7b41a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,bd28311fbf37010b
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <41c78d36@newsgroups.borland.com> <41c79929$3@newsgroups.borland.com> <41c7a03a@newsgroups.borland.com> <41c7a7df$1@newsgroups.borland.com> <41c7b41a@newsgroups.borland.com>
Subject: Re: Close Form in DLL
Date: Tue, 21 Dec 2004 01:17:20 -0800
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <41c7e9f2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1103620594 68.69.17.41 (21 Dec 2004 01:16:34 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.netcologne.de!newsfeed-fusi.netcologne.de!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail