Board index » cppbuilder » Getting handle to an MDI Window

Getting handle to an MDI Window


2007-11-15 11:34:18 PM
cppbuilder36
I hope this is the correct group
I have an MDI app and I need to interact with a Componnet on one of the
child windows - how do I get a handle to the active window - and for that
matter for any of the windows that are on screen?
 
 

Re:Getting handle to an MDI Window

"Paul" < XXXX@XXXXX.COM >wrote in message
Quote
I hope this is the correct group

I have an MDI app and I need to interact with a Componnet on one of the
child windows - how do I get a handle to the active window - and for that
matter for any of the windows that are on screen?
Assuming you are using VCL, the main form has a property called,
"ActiveMDIChild". This will give you the TForm of its active child window.
Once you have the TForm, you can use its "Handle" property to get the window
handle. For instance:
ActiveMDIChild->Handle
...should give you the handle to the currently active child window.
- Dennis
 

Re:Getting handle to an MDI Window

"Dennis Jones" < XXXX@XXXXX.COM >wrote in message
Quote
Assuming you are using VCL, the main form has a property called,
"ActiveMDIChild". This will give you the TForm of its active child
window. Once you have the TForm, you can use its "Handle"
property to get the window handle.
If you are using the VCL, you generally wouldn't interact with components at
the HWND level. There are other ways to access them at the component level
instead, such as the TWinControl::Controls[] array, and using type-casting
or RTTI to access the desired properties.
Gambit
 

{smallsort}