You can subclass the Memo's WindowProc
property at runtime to catch all of messages sent to the Memo, eg:
private:
TWndMethod PrevMemoWndProc;
void __fastcall MemoWndProc(TMessage &Message);
__fastcall TMyForm::TMyForm(TComponent *Owner)
: TForm(Owner)
{
PrevMemoWndProc = Memo1->WindowProc;
Memo1->WindowProc = MemoWndProc;
}
void __fastcall TMyForm::MemoWndProc(TMessage &Message)
{
switch (Message.Msg)
{
case CN_COMMAND:
{
switch (reinterpret_cast<TWMCommand&>(Message).NotifyCode)
{
case EN_VSCROLL:
{
//...
break;
}
case EN_HSCROLL:
{
//...
break;
}
}
break;
}
case WM_HSCROLL:
{
//...
break;
}
case WM_VSCROLL:
{
//...
break;
}
}
PrevMemoWndProc(Message);
}