Page 159 - DCAP408_WEB_PROGRAMMING
P. 159
Unit 9: Child and Pop Up Windows
Notes
Task Make distinction between child window and parent window.
9.2.3 Messages
The system passes a child window’s input messages directly to the child window; the messages
are not passed through the parent window. The only exception is if the child window has been
disabled by the EnableWindow function. In this case, the system passes any input messages that
would have gone to the child window to the parent window instead. This permits the parent
window to examine the input messages and enable the child window, if necessary.
A child window can have a unique integer identifier. Child window identifiers are important
when working with control windows. An application directs a control’s activity by sending it
messages. The application uses the control’s child window identifier to direct the messages to
the control. In addition, a control sends notification messages to its parent window. A notification
message includes the control’s child window identifier, which the parent uses to identify which
control sent the message.
Notes An application specifies the child-window identifier for other types of child windows
by setting the hMenu parameter of the CreateWindowEx function to a value rather than a
menu handle.
Layered Windows
Using a layered window can significantly improve performance and visual effects for a window
that has a complex shape, animates its shape, or wishes to use alpha blending effects. The system
automatically composes and repaints layered windows and the windows of underlying
applications. As a result, layered windows are rendered smoothly, without the flickering typical
of complex window regions. In addition, layered windows can be partially translucent, that is,
alpha-blended.
To create a layered window, specify the WS_EX_LAYERED extended window style when calling
the CreateWindowEx function, or call the SetWindowLong function to set WS_EX_LAYERED
after the window has been created. After the CreateWindowEx call, the layered window will not
become visible until the SetLayeredWindowAttributes or UpdateLayeredWindow function has
been called for this window.
!
Caution WS_EX_LAYERED cannot be used for child windows.
To set the opacity level or the transparency color key for a given layered window, call
SetLayeredWindowAttributes. After the call, the system may still ask the window to paint when
the window is shown or resized. However, because the system stores the image of a layered
window, the system will not ask the window to paint if parts of it are revealed as a result of
relative window moves on the desktop. Legacy applications do not need to restructure their
painting code if they want to add translucency or transparency effects for a window, because the
LOVELY PROFESSIONAL UNIVERSITY 153