Looks usefull, though not tested yet. Francois, what do you think?
Primož Gabrijelcic wrote:
> Hello everybody (and especially Francois).
> I have this legacy code that was written using ICS v5. Deep inside
> message processing (specifically RAS handling) is done in overridden
> When I switched to ICS v6, this code broke. This was mainly expected -
> v6 cannot know which socket's WndProc it should call when it receives
> non-internal (not registered via AllocateMsgHandler) message after
> Still, I had to make old code work with the new message dispatch
> system and
> that's what I did:
> I defined new event handler in the TIcsWndHandler:
> TIcsOnMessageEvent = procedure(Sender: TObject; var MsgRec:
> TMessage) of
> object; //Gp
> TIcsWndHandler = class(TObject)
> FOnMessage : TIcsOnMessageEvent;
> property OnMessage: TIcsOnMessageEvent read FOnMessage write
> In the TIcsWndHandler.WndProc, I call OnMessage if specified:
> procedure TIcsWndHandler.WndProc(var MsgRec: TMessage);
> Dummy : Boolean;
> with MsgRec do begin
> if (Msg >= FMsgLow) and
> (Msg < (FMsgLow + WH_MAX_MSG)) and
> Assigned(FMsgMap[Msg - FMsgLow]) then
> FMsgMap[Msg - FMsgLow].WndProc(MsgRec)
> else begin
> if assigned(OnMessage) then //Gp
> OnMessage(Self, MsgRec); //Gp
> if Result = 0 then //Gp
> Result := DefWindowProc(Handle, Msg, wParam,
> // Les exceptions doivent etre gérées, sinon l'application
> // liquidée dcs qu'une exception se produit !
> on E:Exception do
> TriggerBgException(E, Dummy);
> This way, I can catch all messages received by the TIcsWndHandler and
> appropriate legacy code inside my OnMessage handler.
> I think this is a simple extension that adds much flexibility and
> that I
> should be included in the base code.
> What do others think?
> Best regards,
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