Link to home
Start Free TrialLog in
Avatar of nickamon
nickamon

asked on

How to edit the windows event loop in a c++ builder application.

Hi,

I am writing an application that needs to intercept all messages sent from Windows to my application before the message is dispatched.  

The old way I did it was to edit the GetMessage loop in my WinMain function.  But now I am using Borland C++ Builder and I need to do the same thing.  Any ideas on how?  I want to do something like this:

  while(GetMessage((LPMSG)&Msg,NULL,0,0) > 0){
    if(!checkSourceEvent((LPMSG)&Msg)){  <== ADDED CODE
      TranslateMessage(&Msg);
      DispatchMessage(&Msg);
    }
  }

Thanks In Advance,

Nicholas Amon
Avatar of Kimpan
Kimpan
Flag of Sweden image

why wouldn't the same mechanism work in Borland C++ Builder if you are using Windows?
Avatar of nickamon
nickamon

ASKER

The C++ Buidler does it for you automatically in their Application->Run  method, but it doesn't allow you to edit that code.  I could remove the line and put in my own event loop, but then the VCL will not initialize or deliver events properly.

Thanks,

Nicholas Amon
ASKER CERTIFIED SOLUTION
Avatar of Salte
Salte

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Alot Alf worked like a charm.