🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1527

Re: TClientSocket in consolle applications

#1527
From: Stefano Bonifazi
Date: Sun, 24 Dec 2006 12:17
44 lines
2284 bytes
Thank U again for Ur help!

Bob Gonder wrote:
> I was going to show the Charles Petzold way (plain WinAPI), 

Please do!

> Probably easiest is to have a TApplication::Main1 in your dll.

what do U mean by Main1? Is that a form?


> void __fastcall TMyThread::Execute()
> {
> #if ThisWorks
> 	Main1 = new TMain1( NULL );
> 	Main1->Hide();
> 	while( ! terminated )
> 	{
> 		//process all outstanding messages
> 		Main1->ProcessMessages();	

if Main1 is a form then it has not ProcessMessages() ... that is a 
TApplication method!


> 		//slow it down so the thread doesn't hit so hard
> 		Sleep(0);
> 	};
> 	delete Main1; //not sure about this
> #else
>                 Application->Initialize();
>                 Application->CreateForm(__classid(TMain1), &Main1);
>                 Application->Run();

This seems to work, and the form receives messages correctly! But then 
Application never stops even if I call Application->Terminate() from a 
dll function, or I call MyThread->Terminate() or I close manually the 
form... So an Exception is always thrown when my dll is unloaded it says 
"System error. Code 5. Access forbidden" :(

What can I do?
Thank U again!
Stefano b.
Technical Details
Message-ID: <458e6fe3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <458d3f0d@newsgroups.borland.com> <rklqo2pjrnk6arfk43f665lq65djkr55vq@4ax.com> <458d72cc@newsgroups.borland.com> <fv1ro296vpodms19ois98boakdgo5cd59r@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,dab0ff5b2d1109
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sun, 24 Dec 2006 13:17:58 +0100
From: Stefano Bonifazi <stefboombastic@email.it>
User-Agent: Thunderbird 1.5.0.8 (Windows/20061025)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: TClientSocket in consolle applications
References: <458d3f0d@newsgroups.borland.com> <rklqo2pjrnk6arfk43f665lq65djkr55vq@4ax.com> <458d72cc@newsgroups.borland.com> <fv1ro296vpodms19ois98boakdgo5cd59r@4ax.com>
In-Reply-To: <fv1ro296vpodms19ois98boakdgo5cd59r@4ax.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 80.104.235.114
Message-ID: <458e6fe3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1166962659 80.104.235.114 (24 Dec 2006 04:17:39 -0800)
Lines: 44
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail