🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
11 messages
11 total messages Started by Alvise Valsecchi Wed, 02 Apr 2003 07:22
Intercepting the message loop
#17186
Author: Alvise Valsecchi
Date: Wed, 02 Apr 2003 07:22
3 lines
957 bytes
Hi. How can I intercept a message in the message loop within my BCB3
application ? Thanks. Alvise.
Re: Intercepting the message loop
#17189
Author: Remy Lebeau (TeamB)
Date: Wed, 02 Apr 2003 07:46
14 lines
1386 bytes
"Alvise Valsecchi" <alvise@hochfeiler.it> wrote in message
news:3E8A8FC2.69FF3E30@hochfeiler.it...

> Hi. How can I intercept a message in the message
> loop within my BCB3 application ?

What EXACTLY do you want to intercept and, more imporantly, from where?
There are many ways to intercept messages - assigning an event hander to the
TApplication::OnMessage event, overriding/subclassing WndProc(), using a
MESSAGE_MAP, using a message hook, etc.


Gambit
Re: Intercepting the message loop
#17190
Author: Alvise Valsecchi
Date: Wed, 02 Apr 2003 11:34
12 lines
1532 bytes
Hi Gambit, thanks for replying.

> What EXACTLY do you want to intercept and, more imporantly, from where?

I will let you know in a future post. In my spare time I am trying to
start using the TWAIN SDK, and I read in the documentation that some
events have to be intercepted. This is why I was wondering how to do it
in BCB (I already know how to do it in win32asm and in regular C++).

Anycase your reply is interesting, because it opens some doors.

Please receive my best regards. Alvise.
Re: Intercepting the message loop
#17191
Author: noone
Date: Wed, 02 Apr 2003 13:08
12 lines
1369 bytes
I describe one way of intercepting messages here:

http://www.geocities.com/rodolfofrino/WndProcMouseEntersLeaves.html
http://www.geocities.com/rodolfofrino/WndProcComboBoxNoDropDown.html

Rodolfo

"Alvise Valsecchi" <alvise@hochfeiler.it> wrote in message
news:3E8A8FC2.69FF3E30@hochfeiler.it...
>
> Hi. How can I intercept a message in the message loop within my BCB3
> application ? Thanks. Alvise.
Re: Intercepting the message loop
#17192
Author: Torsten Franz (TeamBeer)
Date: Wed, 02 Apr 2003 13:14
6 lines
1190 bytes
> it in BCB (I already know how to do it in win32asm and in regular
> C++).

That's interesting. How do you do it in "Regular C++"?

Torsten
Re: Intercepting the message loop
#17208
Author: Alvise Valsecchi
Date: Thu, 03 Apr 2003 07:56
16 lines
1703 bytes
"Torsten Franz (TeamBeer)" wrote:
> That's interesting. How do you do it in "Regular C++"?

Not using VCL components and the whole BCB software castle. 

Do you remember those old Win programs when you had to program the
window function of each control, and to program the message loop of the
whole application ? 

With BCB I can't figure out where the message loop is. Once I could see
it, because I had to write it !

Maybe I expressed myself badly. Hope I corrected it. A.V.

P.S.: how many liters of beer have you drunk to become part of the
TeamBeer ?
Re: Intercepting the message loop
#17210
Author: Alvise Valsecchi
Date: Thu, 03 Apr 2003 07:57
8 lines
1334 bytes
"noone@nowhere.nothing.nil" wrote:

> I describe one way of intercepting messages here:
> 
> http://www.geocities.com/rodolfofrino/WndProcMouseEntersLeaves.html
> http://www.geocities.com/rodolfofrino/WndProcComboBoxNoDropDown.html

Thanks. I will read it. Alvise.
Re: Intercepting the message loop
#17209
Author: Torsten Franz (TeamBeer)
Date: Thu, 03 Apr 2003 08:37
28 lines
2084 bytes
> Not using VCL components and the whole BCB software castle.
>
> Do you remember those old Win programs when you had to program the
> window function of each control, and to program the message loop of
> the whole application ?

Yes of course I can. But this is not 'regular C++' but native WinAPI
programming.
Thats why I was curious to learn about the C++ way when C++ doesn't know
anything
about message loops etc. :-)

Btw, have you checked what Remy suggested?

> With BCB I can't figure out where the message loop is. Once I could
> see it, because I had to write it !

Which message loop? The main one from the Application or the one within
threads (if available)
or others?

> P.S.: how many liters of beer have you drunk to become part of the
> TeamBeer ?

It wasn't too hard to become a member, but one need to have a lot of
training sessions to keep the level ;-)

Torsten
Re: Intercepting the message loop
#17323
Author: Remy Lebeau (TeamB)
Date: Thu, 03 Apr 2003 18:13
20 lines
1972 bytes
"Alvise Valsecchi" <alvise@hochfeiler.it> wrote in message
news:3E8BE91D.8C76C76B@hochfeiler.it...

> With BCB I can't figure out where the message loop is.

It is inside the TApplication::Run() method.  You don't have direct access
to it unless you remove the call to Application->Run() entirely and run your
own manual message loop instead.  But then the VCL won't work 100% correctly
anymore, as TApplication::Run() does some things internally on behalf of the
VCL which you can't execute manually as they are private to the VCL's core.

Please see my other reply, I already told you how you can hook into the
native message loop.  You didn't answer my original question, though - what
EXACTLY do you want to intercept?  Depending on what you want to intercect,
and more importantly where, there are a number of different ways to get at
it.


Gambit
Re: Intercepting the message loop
#17345
Author: Alvise Valsecchi
Date: Fri, 04 Apr 2003 07:15
21 lines
1844 bytes
"Torsten Franz (TeamBeer)" wrote:
> But this is not 'regular C++' but native WinAPI programming.

You are right. This is what I meant.

> Thats why I was curious to learn about the C++ way when C++ doesn't know
> anything about message loops etc. :-)

You are right again. 

> Btw, have you checked what Remy suggested?

Not yet. I must solve another problem about TWAIN SDK before proceeding.

> Which message loop? The main one from the Application or the one within
> threads (if available) or others?

The main loop of the application. Gambit added a new post explaining
this (p.se see Gambit's reply under your post).

Regards. Alvise.
Re: Intercepting the message loop
#17348
Author: Alvise Valsecchi
Date: Fri, 04 Apr 2003 07:22
21 lines
2092 bytes
"Remy Lebeau (TeamB)" wrote:

> It is inside the TApplication::Run() method.  You don't have direct access
> to it unless you remove the call to Application->Run() entirely and run your
> own manual message loop instead.  But then the VCL won't work 100% correctly
> anymore, as TApplication::Run() does some things internally on behalf of the
> VCL which you can't execute manually as they are private to the VCL's core.

Thanks for this clear explanation. I wasn't aware of this.

>You didn't answer my original question, though - what
> EXACTLY do you want to intercept?  

I will tell you in a future post. I just read the TWAIN's programming
documentation and it was written that some events would have to be
intercepted from the user's application. That's all. In the meantime I
was asking myself "where the application's message loop is ?" and you
kindly gave me sufficient information to go ahead for the moment. As
soon as I will dig into the program code I can tell you.

Regards. Alvise.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads