Article View: comp.windows.ms.programmer
Article #2884Re: Window Handles: what's real?
From: Eric Lapaille
Date: Wed, 22 May 1991 19:54
Date: Wed, 22 May 1991 19:54
124 lines
7518 bytes
7518 bytes
> When I use a CreateWindow call, my window's message
> function gets called with one of the parameters being
> hWnd.
>
> When the CreateWindow call returns it gives me the hWnd
> for the window just created.
When you pass a hWnd as argument to the CreateWindow function , it's the
handle of the parent's window not the window itself.
CreateWindow
Syntax HWND CreateWindow(lpClassName, lpWindowName, dwStyle, X, Y, nWidth,
nHeight, hWndParent, hMenu, hInstance, lpParam)
Parameter Type/Description
lpClassName LPSTR Points to a null-terminated character string
that names the window class. The class name can be
any name registered with the RegisterClass function
or any of the predefined control-class names
specified in Table T.2, "Control Classes."
lpWindowName LPSTR Points to a null-terminated character string
that represents the window name.
dwStyle DWORD Specifies the style of window being created.
It can be any combination of the styles given in
Table T.3, "Window Styles, " the control styles
given in Table 4.4, "Control Styles, " or a
combination of styles created by usingthe bitwise OR
operator.
X int Specifies the initial x-position of the window.
For an overlapped or pop-up window, the X parameter
is the initial x-coordinate of the window's
upper-left corner (in screen coordinates). If this
value is CW_USEDEFAULT, Windows selects the default
position for the window's upper-left corner. For a
child window, X is the x-coordinate of the
upper-left corner of the window in the client area
of its parent window.
Y int Specifies the initial y-position of the window.
For an overlapped window, the Y parameter is the
initial y-coordinate of the window's upper-left
corner. For a pop-up window, Y is the y-coordinate
(in screen coordinates) of the upper-left corner of
the pop-up window. For list-box controls, Y is the y
-coordinate of the upper-left corner of the
control's client area. For a child window, Y is the
y-coordinate of the upper-left corner of the child
window. All of these coordinates are for the window,
not the window's client area.
nWidth int Specifies the width (in device units) of the
window. For overlapped windows, the nWidth parameter
is either the window's width (in screen coordinates)
or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT,
Windows selects a default width and height for the
window (the default width extends from the initial x
-position to the right edge of the screen,, and the
default height extends from the initial y-position
to the top of the icon area).
nHeight int Specifies the height (in device units) of the
window. For overlapped windows, the nHeight
parameter is the window's height in screen
coordinates. If the nWidth parameter is
CW_USEDEFAULT, Windows ignores nHeight.
hWndParent HWND Identifies the parent or owner window of the
window being created. A valid window handle must be
supplied when creating a child window or an owned
window. An owned window is an overlapped window that
is destroyed when its owner window is destroyed,
hidden when its owner is made iconic, and which is
always displayed on top of its owner window. For
pop-up windows, a handle can be supplied, but is not
required. If the window does not have a parent or is
not owned by another window, the hWndParent
parameter must be set to NULL.
hMenu HMENU Identifies a menu or a child-window
identifier. The meaning depends on the window style.
For overlapped or pop-up windows, the hMenu
parameter identifies the menu to be used with the
window. It can be NULL, if the class menu is to be
used. For child windows, hMenu specifies the
child-window identifier, an integer value that is
used by a dialog-box control to notify its parent of
events (such as the EN_HSCROLL message). The
child-window identifier is determined by the
application and should be unique for all child
windows with the same parent window.
hInstance HANDLE Identifies the instance of the module to be
associated with the window.
lpParam LPSTR Points to a value that is passed to the window
through the CREATESTRUCT data structure referenced
by the lParam parameter of the WM_CREATE message. If
an application is calling CreateWindow to create a
multiple document interface (MDI) client window,
lpParam must point to a CLIENTCREATESTRUCT data
structure.
Return Value The return value identifies the new window. It is NULL if the
window is not created.
Comments For overlapped windows where the X parameter is CW_USEDEFAULT, the
Y parameter can be one of the show-style parameters described with
the ShowWindow function, or, for the first overlapped window to be
created by the application, it can be the nCmdShow parameter passed
to the WinMain function.
See also: ^QControl Classes^P
^QWindow Styles^P
^QControl Styles^P
-^D-
Technical Details
Message-ID:
<674880455@p2721.f27.n295.z2.fidonet.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!mcsun!unido!rwthinf!slcdec!hippo!f1.n6000.z2.fidonet.org!p2721.f27.n295.z2.fidonet.org!Eric_LapailleReferences:
<5175@servax0.essex.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!mcsun!unido!rwthinf!slcdec!hippo!f1.n6000.z2.fidonet.org!p2721.f27.n295.z2.fidonet.org!Eric_Lapaille From: Eric_Lapaille@p2721.f27.n295.z2.fidonet.org (Eric Lapaille) Newsgroups: comp.windows.ms.programmer Subject: Re: Window Handles: what's real? Message-ID: <674880455@p2721.f27.n295.z2.fidonet.org> Date: 22 May 91 19:54:30 GMT References: <5175@servax0.essex.ac.uk> Reply-To: Eric_Lapaille%p2721.f27.n295.z2@hippo.dfv.rwth-aachen.de (Eric Lapaille) Organization: Un point * l'endroit. Lines: 125 Comment-To: Whiteside_S_D_B@f1.n6000.z2.fidonet.org (Whiteside S D B)