But TWSocket will swallow the exception, so use this:
var
AFlag:Boolean
procedure TForm.WSocketDataAvailable(Sender: TObject; ErrCode: Word);
begin
try
if AFlag then
raise Exception.Create('reentered');
AFlag := TRUE;
try
[..]
finally
AFlag : FALSE
end;
except
on E: Exception do
ShowMessage(E.Message); // or WriteLn or add to Memo or whatever
end;
end;
---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz
Friday, September 1, 2006, 08:15, Arno Garrels wrote:
> Markus Humm wrote:
>> I don't call processmessages and the like directly in the event but
>> might output some lines on screen for debugging.
> How? ShowMessage is a modal form.
>>
>> Other thing: what about critical sections. Would they be safe for
>> preventing this in my situation?
> No, critical sections would be working only when they are used
> from multiple threads.
> You could try something like below, is the exception raised?
> var
> AFlag:Boolean
> procedure TForm.WSocketDataAvailable(Sender: TObject; ErrCode: Word);
> begin
> if AFlag then
> raise Exception.Create('reentered');
> AFlag := TRUE;
> try
> [..]
> finally
> AFlag : FALSE
> end;
> end;
> ---
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
>> Greetings
>>
>> Markus
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be