Member Avatar for stinkypete
stinkypete

I am trying to catch EN_VSCROLL (vertical scroll) messages from a richedit control.
So far I have done the following:

In the form's oncreate:

int mask = SendMessage(richedit->Handle, EM_GETEVENTMASK, 0, 0);
SendMessage(richedit->Handle, EM_SETEVENTMASK, 0, mask + ENM_SCROLL);
Application->OnMessage = AppMessage;

My onmessage function is:

void form::AppMessage(tagMsg &Msg, bool &Handled)
{
  Handled = false;
  if ((Msg.message == WM_COMMAND) && (Msg.wParam == EN_VSCROLL))
  {
    // do something useful
    Handled = true;
  }
}

But nothing happens, i.e. the EN_VSCROLL message doesn't appear. From what I've seen via Google this is all I need to do, so why isn't it happening? Is it because I'm using OnMessage? I'm using Borland C++ Builder version 4 on Windows 98 which I know are both ancient, but they are reliable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.