Hello everybody (and especially Francois). I have this legacy code that was written using ICS v5. Deep inside some message processing (specifically RAS handling) is done in overridden WndProc methods.
When I switched to ICS v6, this code broke. This was mainly expected - ICS v6 cannot know which socket's WndProc it should call when it receives some non-internal (not registered via AllocateMsgHandler) message after all. 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 FOnMessage; //Gp In the TIcsWndHandler.WndProc, I call OnMessage if specified: procedure TIcsWndHandler.WndProc(var MsgRec: TMessage); var Dummy : Boolean; begin try 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, lParam); end; end; except // Les exceptions doivent ętre gérées, sinon l'application sera // liquidée dčs qu'une exception se produit ! on E:Exception do TriggerBgException(E, Dummy); end; end; This way, I can catch all messages received by the TIcsWndHandler and call 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, Primoz -- 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