Re: [twsocket] ICS Wnd Control - Possible bug

2010-08-18 Thread Arno Garrels
Eric,

I guess it helps to remove all pending messages with the given ID
from the queue when the message ID is unregistered.

One could do that either in custom code or maybe it should
be added in TIcsWndHandler.UnregisterMessage as below?

procedure TIcsWndHandler.UnregisterMessage(var Msg: UINT);
var
LMsg: TMsg; // == added
begin
if Msg = 0 then
Exit;
if FMsgLow  WM_USER then
raise EIcsException.Create('MsgLow not defined');
if Msg = (FMsgLow + WH_MAX_MSG) then
raise EIcsException.Create('Msg value out of bound');
if not Assigned(FMsgMap[Msg - FMsgLow]) then
raise EIcsException.Create('Msg not registered');
FMsgMap[Msg - FMsgLow] := nil;
Dec(FMsgCnt);
Msg := 0;
while PeekMessage(LMsg, FHandle, Msg, Msg, PM_REMOVE) do {loop}; // == 
added
if FMsgCnt = 0 then
DeallocateHWnd;
end;

-- 
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS Wnd Control - Possible bug

2010-08-18 Thread Eric Fleming Bonilha

HI Arno

True, I think that will help, I will add this line to my ICS code to check 
if it works, but I believe that it will work


I also think that this is something that must be on ICS code, on 
UnregisterMessage as you proposed, not custom code.


I will test and come back to you soon

Eric


--
From: Arno Garrels arno.garr...@gmx.de
Sent: Wednesday, August 18, 2010 11:43 AM
To: ICS support mailing twsocket@elists.org
Subject: Re: [twsocket] ICS Wnd Control - Possible bug


Eric,

I guess it helps to remove all pending messages with the given ID
from the queue when the message ID is unregistered.

One could do that either in custom code or maybe it should
be added in TIcsWndHandler.UnregisterMessage as below?

procedure TIcsWndHandler.UnregisterMessage(var Msg: UINT);
var
   LMsg: TMsg; // == added
begin
   if Msg = 0 then
   Exit;
   if FMsgLow  WM_USER then
   raise EIcsException.Create('MsgLow not defined');
   if Msg = (FMsgLow + WH_MAX_MSG) then
   raise EIcsException.Create('Msg value out of bound');
   if not Assigned(FMsgMap[Msg - FMsgLow]) then
   raise EIcsException.Create('Msg not registered');
   FMsgMap[Msg - FMsgLow] := nil;
   Dec(FMsgCnt);
   Msg := 0;
   while PeekMessage(LMsg, FHandle, Msg, Msg, PM_REMOVE) do {loop}; // == 
added

   if FMsgCnt = 0 then
   DeallocateHWnd;
end;

--
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be






Nenhum virus encontrado nessa mensagem recebida.
Verificado por AVG - www.avgbrasil.com.br
Versao: 9.0.851 / Banco de dados de virus: 271.1.1/3079 - Data de 
Lancamento: 08/18/10 03:35:00



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS Wnd Control - Possible bug

2010-08-18 Thread Eric Fleming Bonilha

   Msg := 0;
   while PeekMessage(LMsg, FHandle, Msg, Msg, PM_REMOVE) do {loop}; // == 
added

   if FMsgCnt = 0 then
   DeallocateHWnd;
end;


Just a little correction

   while PeekMessage(LMsg, FHandle, Msg, Msg, PM_REMOVE) do {loop}; // == 
added

   Msg := 0;


Or else you will pass 0 to PeekMessage


Eric


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS Wnd Control - Possible bug

2010-08-18 Thread Arno Garrels
Arno Garrels wrote:
 Eric,
 
 I guess it helps to remove all pending messages with the given ID
 from the queue when the message ID is unregistered.
 
 One could do that either in custom code or maybe it should
 be added in TIcsWndHandler.UnregisterMessage as below?

Previous code did remove message ID 0 (I should not code in OE 8-)
corrected code:

procedure TIcsWndHandler.UnregisterMessage(var Msg: UINT);
var
LMsg: TMsg; // == added
begin
if Msg = 0 then
Exit;
if FMsgLow  WM_USER then
raise EIcsException.Create('MsgLow not defined');
if Msg = (FMsgLow + WH_MAX_MSG) then
raise EIcsException.Create('Msg value out of bound');
if not Assigned(FMsgMap[Msg - FMsgLow]) then
raise EIcsException.Create('Msg not registered');
FMsgMap[Msg - FMsgLow] := nil;
Dec(FMsgCnt);
while PeekMessage(LMsg, FHandle, Msg, Msg, PM_REMOVE) do {loop}; // == 
added
Msg := 0;
if FMsgCnt = 0 then
DeallocateHWnd;
end;
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be