Page 158 - DCAP408_WEB_PROGRAMMING
P. 158
Windows Programming
Notes
return 0;
}
//—————————————————————————————————————-
Self Assessment
Fill in the blanks:
1. ......................... helps to maintain child (popup) windows, especially when you need multiple
child windows and each window needs different features.
2. When you call the object’s load() method you pass it a .........................
3. The ......................... inherits from System.Windows.Controls.ChildWindow so you must
add that as a reference
9.2 Sending Messages to Child Windows
9.2.1 Child Windows
A child window has the WS_CHILD style and is confined to the client area of its parent window.
An application typically uses child windows to divide the client area of a parent window into
functional areas. You create a child window by specifying the WS_CHILD style in the
CreateWindowEx function.
A child window must have a parent window. The parent window can be an overlapped window,
a pop-up window, or even another child window. You specify the parent window when you call
CreateWindowEx.
Did u know? If you specify the WS_CHILD style in CreateWindowEx but do not specify a
parent window, the system does not create the window.
9.2.2 Relationship to Parent Window
An application can change the parent window of an existing child window by calling the SetParent
function. In this case, the system removes the child window from the client area of the old parent
window and moves it to the client area of the new parent window. If SetParent specifies a NULL
handle, the desktop window becomes the new parent window. In this case, the child window is
drawn on the desktop, outside the borders of any other window. The GetParent function retrieves
a handle to a child window’s parent window.
The parent window relinquishes a portion of its client area to a child window, and the child
window receives all input from this area. The window class need not be the same for each of the
child windows of the parent window. This means that an application can fill a parent window
with child windows that look different and carry out different tasks.
Example: A dialog box can contain many types of controls, each one a child window that
accepts different types of data from the user.
152 LOVELY PROFESSIONAL UNIVERSITY