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

Reply via email to