-
child window - is it or isn't it?
Hi Folks
This is one of several sub-problems that I need to solve in order to solve
a larger problem with printing documents using Word 97 via automation from
VBA. The larger problem will require the use of the win32 API from VBA,
hence my desperate resort to this forum!
Say you use MS Word 97 to print a document whose margins are set outside
the printable area of the page. Word displays a popup message: "The margins
of section 1 are set outside the printable area of the page. Do you want to
continue? [Yes]/[No]".
I'm confused as to whether that popup IS or ISN'T a child window of the
Word main window.
The message can be dragged outside the boundaries of the Word main window,
which suggests to me that it is NOT a child window. (I believe child
windows are constrained to the parent window area. Yes?)
However, if I call GetParent on its window handle, I get the Word main
window handle - which suggests the popup IS a child window!
Can anyone tell me whether the popup in question IS or ISN'T a child window
of the Word main window (& explain the discrepancy noted above)?
The popup in question gives the following display when using a VBA
equivalent of the "Spy" type code in Q112649. (My output interprets the
window style bits.)
_____________________
Window Handle: &H5CC
Window Text: Microsoft Word
Window Class Name: #32770
Window Style: &H94C801C5
-- window styles --
WS_OVERLAPPED
WS_POPUP
WS_VISIBLE
WS_CLIPSIBLINGS
WS_CAPTION
WS_BORDER
WS_DLGFRAME
WS_SYSMENU
WS_TILED
-- common styles --
WS_POPUPWINDOW
-- extended styles --
WS_EX_DLGMODALFRAME
WS_EX_NOPARENTNOTIFY
Window ID Number: &H0
Parent Window Handle: &HBD0
Parent Window Text: Microsoft Word - zz cert Aow-fc.doc
Parent Window Class Name: OpusApp
Module: C:\PROGRAM FILES\OFFICE97\OFFICE\MSACCESS.EXE
_____________________
TIA,
TC
-
Re: child window - is it or isn't it?
Jonathan Wood <jwood@softcircuits.com> wrote in article
<39cf60e0@news.devx.com>...
> > The message can be dragged outside the boundaries of the Word main
window,
> > which suggests to me that it is NOT a child window. (I believe child
> > windows are constrained to the parent window area. Yes?)
>
> Yes, this is correct. Note that WS_CHILD is not one of the reported
window
> styles.
>
> > However, if I call GetParent on its window handle, I get the Word main
> > window handle - which suggests the popup IS a child window!
>
> This is sometimes referred to as an owned window. It is not a true child
> window but still has a parent that is always underneath it.
>
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
Hi Jonathan
Thanks for your very prompt reply. (I posted less than an hour ago. It's
midnight here. I hate to think what it is "there" (wherever "there" is!))
When you say "owned" window, are you saying that a window can have an
"owner" window independently of its "parent" window (if any)?
I assumed that (a) GetParent would return the "parent" window (if any), and
(b) any window with a "parent" window (as returned by GetParent) was
necessarily a "child" window.
Could you elucidate (or point me to a clear explanation of) "owner" window,
"parent" window and "child" window?
Thanks,
TC
-
Re: child window - is it or isn't it?
Jonathan Wood <jwood@softcircuits.com> wrote in article
<39cf60e0@news.devx.com>...
> > The message can be dragged outside the boundaries of the Word main
window,
> > which suggests to me that it is NOT a child window. (I believe child
> > windows are constrained to the parent window area. Yes?)
>
> Yes, this is correct. Note that WS_CHILD is not one of the reported
window
> styles.
>
> > However, if I call GetParent on its window handle, I get the Word main
> > window handle - which suggests the popup IS a child window!
>
> This is sometimes referred to as an owned window. It is not a true child
> window but still has a parent that is always underneath it.
>
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
Hi Jonathan
Thanks for your very prompt reply. (I posted less than an hour ago. It's
midnight here. I hate to think what it is "there" (wherever "there" is!))
When you say "owned" window, are you saying that a window can have an
"owner" window independently of its "parent" window (if any)?
I assumed that (a) GetParent would return the "parent" window (if any), and
(b) any window with a "parent" window (as returned by GetParent) was
necessarily a "child" window.
Could you elucidate (or point me to a clear explanation of) "owner" window,
"parent" window and "child" window?
Thanks,
TC
-
Re: child window - is it or isn't it?
> The message can be dragged outside the boundaries of the Word main window,
> which suggests to me that it is NOT a child window. (I believe child
> windows are constrained to the parent window area. Yes?)
Yes, this is correct. Note that WS_CHILD is not one of the reported window
styles.
> However, if I call GetParent on its window handle, I get the Word main
> window handle - which suggests the popup IS a child window!
This is sometimes referred to as an owned window. It is not a true child
window but still has a parent that is always underneath it.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
-
Re: child window - is it or isn't it?
> The message can be dragged outside the boundaries of the Word main window,
> which suggests to me that it is NOT a child window. (I believe child
> windows are constrained to the parent window area. Yes?)
Yes, this is correct. Note that WS_CHILD is not one of the reported window
styles.
> However, if I call GetParent on its window handle, I get the Word main
> window handle - which suggests the popup IS a child window!
This is sometimes referred to as an owned window. It is not a true child
window but still has a parent that is always underneath it.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
-
Re: child window - is it or isn't it?
TC,
> When you say "owned" window, are you saying that a window can have an
> "owner" window independently of its "parent" window (if any)?
>
> I assumed that (a) GetParent would return the "parent" window (if any),
and
> (b) any window with a "parent" window (as returned by GetParent) was
> necessarily a "child" window.
>
> Could you elucidate (or point me to a clear explanation of) "owner"
window,
> "parent" window and "child" window?
Assumption (a) is correct. Assumption (b) is not correct if the owned window
does not have the WS_CHILD style.
I don't know a good source for this information. Examples of it include
owned popup windows such as message boxes, floating toolbars, and the
drop-down window of a combo box.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
-
Re: child window - is it or isn't it?
TC,
> When you say "owned" window, are you saying that a window can have an
> "owner" window independently of its "parent" window (if any)?
>
> I assumed that (a) GetParent would return the "parent" window (if any),
and
> (b) any window with a "parent" window (as returned by GetParent) was
> necessarily a "child" window.
>
> Could you elucidate (or point me to a clear explanation of) "owner"
window,
> "parent" window and "child" window?
Assumption (a) is correct. Assumption (b) is not correct if the owned window
does not have the WS_CHILD style.
I don't know a good source for this information. Examples of it include
owned popup windows such as message boxes, floating toolbars, and the
drop-down window of a combo box.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
-
Re: child window - is it or isn't it?
Jonathan
After further investigation I've found the following article which explains
the differences:
Q84190: INFO: Window Owners and Parents.
When I've digested it, I'll post the next part of my multi-part problem!
Thanks again for your help,
TC
Jonathan Wood <jwood@softcircuits.com> wrote in article
<39cf79f3@news.devx.com>...
> TC,
>
> > When you say "owned" window, are you saying that a window can have an
> > "owner" window independently of its "parent" window (if any)?
> >
> > I assumed that (a) GetParent would return the "parent" window (if any),
> and
> > (b) any window with a "parent" window (as returned by GetParent) was
> > necessarily a "child" window.
> >
> > Could you elucidate (or point me to a clear explanation of) "owner"
> window,
> > "parent" window and "child" window?
>
> Assumption (a) is correct. Assumption (b) is not correct if the owned
window
> does not have the WS_CHILD style.
>
> I don't know a good source for this information. Examples of it include
> owned popup windows such as message boxes, floating toolbars, and the
> drop-down window of a combo box.
>
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
-
Re: child window - is it or isn't it?
Jonathan
After further investigation I've found the following article which explains
the differences:
Q84190: INFO: Window Owners and Parents.
When I've digested it, I'll post the next part of my multi-part problem!
Thanks again for your help,
TC
Jonathan Wood <jwood@softcircuits.com> wrote in article
<39cf79f3@news.devx.com>...
> TC,
>
> > When you say "owned" window, are you saying that a window can have an
> > "owner" window independently of its "parent" window (if any)?
> >
> > I assumed that (a) GetParent would return the "parent" window (if any),
> and
> > (b) any window with a "parent" window (as returned by GetParent) was
> > necessarily a "child" window.
> >
> > Could you elucidate (or point me to a clear explanation of) "owner"
> window,
> > "parent" window and "child" window?
>
> Assumption (a) is correct. Assumption (b) is not correct if the owned
window
> does not have the WS_CHILD style.
>
> I don't know a good source for this information. Examples of it include
> owned popup windows such as message boxes, floating toolbars, and the
> drop-down window of a combo box.
>
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|