[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 519
  • Last Modified:

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
0
nickamon
Asked:
nickamon
  • 2
1 Solution
 
KimpanCommented:
why wouldn't the same mechanism work in Borland C++ Builder if you are using Windows?
0
 
nickamonAuthor Commented:
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
0
 
SalteCommented:
The builder has a OnMessage or something like that method that you can use to modify the message before it is passed on further.

Alf
0
 
nickamonAuthor Commented:
Thanks Alot Alf worked like a charm.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now