Page 160 - DCAP408_WEB_PROGRAMMING
P. 160
Windows Programming
Notes system redirects the painting of windows that called SetLayeredWindowAttributes into off-
screen memory and recomposes it to achieve the desired effect. For faster and more efficient
animation or if per-pixel alpha is needed, call UpdateLayeredWindow. UpdateLayeredWindow
should be used primarily when the application must directly supply the shape and content of a
layered window, without using the redirection mechanism the system provides through
SetLayeredWindowAttributes. In addition, using UpdateLayeredWindow directly uses memory
more efficiently, because the system does not need the additional memory required for storing
the image of the redirected window. For maximum efficiency in animating windows, call
UpdateLayeredWindow to change the position and the size of a layered window.
!
Caution After SetLayeredWindow Attributes has been called, subsequent
UpdateLayeredWindow calls will fail until the layering style bit is cleared and set again.
Hit testing of a layered window is based on the shape and transparency of the window. This
means that the areas of the window that are color-keyed or whose alpha value is zero will let the
mouse messages through. However, if the layered window has the WS_EX_TRANSPARENT
extended window style, the shape of the layered window will be ignored and the mouse events
will be passed to other windows underneath the layered window.
Message-Only Windows
A message-only window enables you to send and receive messages. It is not visible, has no z-
order, cannot be enumerated, and does not receive broadcast messages. The window simply
dispatches messages.
To create a message-only window, specify the HWND_MESSAGE constant or a handle to an
existing message-only window in the hWndParentparameter of the CreateWindowEx function.
You can also change an existing window to a message-only window by specifying
HWND_MESSAGE in the hWndNewParent parameter of the SetParent function.
To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the
FindWindowEx function. In addition, FindWindowEx searches message-only windows as well
as top-level windows if both the hwndParent and hwndChildAfter parameters are NULL.
Task Illustrate the function of message-only window.
Self Assessment
Fill in the blanks:
4. A child window has the ......................... style and is confined to the client area of its parent
window.
5. An application can change the parent window of an existing child window by calling the
......................... function.
6. An application directs a control’s activity by sending it .........................
7. A ......................... message includes the control’s child window identifier, which the parent
uses to identify which control sent the message.
154 LOVELY PROFESSIONAL UNIVERSITY