Board index » cppbuilder » Message reflection from non-vcl parents...

Message reflection from non-vcl parents...

Under the native VCL, TWinControl already handles that internally for you,
wrapping the messages in VCL-created CM_... and CN_... equivlent messages.

I'm guessing, though, that you're not managing the parent window yourself,
but instead are merely receiving a HWND from the calling application?

Do note that when creating VCL component instances, TWinControl has an
alternative constructor that takes an HWND as a parameter when the Parent
window is to be a non-VCL window.  You don't subclass the parent window
itself.  You subclass the individual components you're using (assuming
you're using native components and not deriving your own) and intercept the
messages that the parent window forwards to the components.

Gambit

Quote
"Early Ehlinger" <ear...@yahoo.com> wrote in message

news:3e22d8ac$1@newsgroups.borland.com...
Quote
> In order for the VCL component to work properly, the parent
> window will need to reflect the appropriate messages (WM_NOTIFY,
> WM_COMMAND, etc) back to the VCL control.  This implies that
> I need to subclass the parent and guarantee that it does indeed do this.

 

Re:Message reflection from non-vcl parents...


Scratch that last part.

Gambit

"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3e23044c$1@newsgroups.borland.com...

Quote
> You don't subclass the parent window itself.  You subclass the individual
> components you're using (assuming you're using native components and
> not deriving your own) and intercept the messages that the parent window
> forwards to the components.

Re:Message reflection from non-vcl parents...


So I /do/ need to subclass the parent, as I originally thought, or using the
constructor that takes a HWND will make the base class do the subclassing
for me?

--
-- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697 --
- RenderFarm - Lightwave , 3dSMax , Bryce , Maya , AfterEffects -
--- www.respower.com -- 200+ GHz Starting At USD$0.50/GHz*Hour --
----------------- SuperComputing For the Masses! ----------------
"I'm so busy programming my computer to let me be lazy, I never
get any rest!" - John Kaster

"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3e23046e@newsgroups.borland.com...

Quote
> Scratch that last part.

> Gambit

> "Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
> news:3e23044c$1@newsgroups.borland.com...
> > You don't subclass the parent window itself.  You subclass the
individual
> > components you're using (assuming you're using native components and
> > not deriving your own) and intercept the messages that the parent window
> > forwards to the components.

Re:Message reflection from non-vcl parents...


No, the HWND constructor does not do any subclassing for you.  It only sets
up the child-parent relationship, nothing else.

What EXACT messages do you need to handle?  any messages that are sent to
the prent window are the responsibility of the parent window to handle, not
the child controls.  The parent has to tell the child what to do
accordingly.

Gambit

Quote
"Early Ehlinger" <ear...@yahoo.com> wrote in message

news:3e230c42@newsgroups.borland.com...
Quote
> So I /do/ need to subclass the parent, as I originally thought,
> or using the constructor that takes a HWND will make the
> base class do the subclassing for me?

Re:Message reflection from non-vcl parents...


"Remy Lebeau (TeamB)" <gambi...@yahoo.com> wrote in message
news:3e232276$1@newsgroups.borland.com...

Quote
> What EXACT messages do you need to handle?  any messages that are sent to
> the prent window are the responsibility of the parent window to handle,
not
> the child controls.  The parent has to tell the child what to do
> accordingly.

The messages that are normally (in VCL) reflected by TWinControls as CN_xxx.
I'm not sure of the exact subset at the moment, but I know that WM_COMMAND
will be one of them.

I guess I'll write a simple
subclass-parent-HWND-and-reflect-appropriate-messages and post my results.

Thanks as always, Remy!

--
-- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697 --
- RenderFarm - Lightwave , 3dSMax , Bryce , Maya , AfterEffects -
--- www.respower.com -- 200+ GHz Starting At USD$0.50/GHz*Hour --
----------------- SuperComputing For the Masses! ----------------
"I'm so busy programming my computer to let me be lazy, I never
get any rest!" - John Kaster

Re:Message reflection from non-vcl parents...


First, thanks very much to Remy for helping me understand the reflection
mechanism better.

Second, I have written a simple class to support what I'm trying to do.  It
is largely untested right now, but I've created a page where others can
download it if they'd like to play around with it:

http://www.respower.com/~earlye/programming/20030113.001.htm

Best Regards,
--
-- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697 --
- RenderFarm - Lightwave , 3dSMax , Bryce , Maya , AfterEffects -
--- www.respower.com -- 200+ GHz Starting At USD$0.50/GHz*Hour --
----------------- SuperComputing For the Masses! ----------------
"I'm so busy programming my computer to let me be lazy, I never
get any rest!" - John Kaster

Quote
"Early Ehlinger" <ear...@yahoo.com> wrote in message

news:3e22d8ac$1@newsgroups.borland.com...
Quote
> I am writing a DLL that contains some VCL components and a C-style api for
> utilizing those components.  The DLL is a plugin for a third-party
> application (hence the C-style api).  In order for the VCL component to
work
> properly, the parent window will need to reflect the appropriate messages
> (WM_NOTIFY,WM_COMMAND, etc) back to the VCL control.  This implies that I
> need to subclass the parent and guarantee that it does indeed do this.

> I have a sneaking suspicion that this sort of thing has been handled in
the
> past by others, but a google search has turned up nothing (perhaps I'm
being
> a meathead in my choice of keywords...).  Does anybody have any experience
> with this or pointers to tutorials?

> Thanks in advance!

> --
> -- Early Ehlinger CEO, ResPower Inc - Toll-Free : 866-737-7697 --
> - RenderFarm - Lightwave , 3dSMax , Bryce , Maya , AfterEffects -
> --- www.respower.com -- 200+ GHz Starting At USD$0.50/GHz*Hour --
> ----------------- SuperComputing For the Masses! ----------------
> "I'm so busy programming my computer to let me be lazy, I never
> get any rest!" - John Kaster

Other Threads