?
Solved

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

Posted on 2003-02-20
4
Medium Priority
?
496 Views
Last Modified: 2009-07-29
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
Comment
Question by:nickamon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Kimpan
ID: 7991785
why wouldn't the same mechanism work in Borland C++ Builder if you are using Windows?
0
 

Author Comment

by:nickamon
ID: 7992848
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
 
LVL 12

Accepted Solution

by:
Salte earned 200 total points
ID: 7993302
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
 

Author Comment

by:nickamon
ID: 7997572
Thanks Alot Alf worked like a charm.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question