Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WinCreateStdWindow (1.2)
◄Function Group► ◄Overview► ◄Changes► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_WINFRAMEMGR
HWND WinCreateStdWindow(hwndParent, flStyle, pflCreateFlags,
pszClientClass, pszTitle, flClientStyle, hmod, idResources,
phwndClient)
HWND hwndParent; /* handle of the parent window */
ULONG flStyle; /* frame-window style */
PULONG pflCreateFlags; /* creation flags */
PSZ pszClientClass; /* client-window class name */
PSZ pszTitle; /* address of title-bar text */
ULONG flClientStyle; /* client-window style */
HMODULE hmod; /* handle of the resource module */
USHORT idResources; /* frame-window identifier */
PHWND phwndClient; /* address of the client-window handle */
The WinCreateStdWindow function creates a standard frame window.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hwndParent Identifies the parent window. A main window is created if
this parameter is HWND_DESKTOP or a window handle returned
by the WinQueryDesktopWindow function. An object window is
created if this parameter is HWND_OBJECT or a window handle
returned by the WinQueryObjectWindow function.
flStyle Specifies the frame-window style. It can be any combination
of the WS_ styles (see ◄Window styles►) and the FS_ styles
(see ◄Frame styles►).
pflCreateFlags Specifies options that control how the frame window is
created. If no options are specified, FCF_STANDARD is used.
For a list of possible flags that may be used with this
parameter, see the ◄Frame control flags► topic.
pszClientClass Points to the client-window class name. If the
pszClientClass parameter is not a zero-length string, a
client window of style flClientStyle and class
pszClientClass is created. This parameter is an
application-specified name (defined by the WinRegisterClass
function), the name of a preregistered WC class, or a WC
constant. If this parameter is NULL, no client area is
created.
pszTitle Points to the title-bar text. This parameter is ignored if
FCF_TITLEBAR is not specified in the pflCreateFlags
parameter.
flClientStyle Specifies the client-window style. For a list of styles that
can be used for this parameter, see the ◄Window styles►
topic.
This parameter is ignored if the pszClientClass parameter is
a zero-length string.
hmod Identifies the module that contains the resource
definitions. This parameter can be either the module handle
returned by the DosLoadModule function or NULL for the
application's module. This parameter is ignored unless
FS_ICON, FS_ACCELTABLE, or FS_MENU is specified in the
flStyle parameter.
idResources Identifies the frame-window identifier and the identifier
within the resource definition of the required resource. The
application must ensure that all resources related to one
frame window have the same identifier value.
phwndClient Points to the variable that receives the client-window
handle. It will be NULL if the function fails.
Return Value
The return value is the handle of the frame window, or it is NULL if an
error occurs.
Comments
The client window created by WinCreateStdWindow does not have an owner. If
the client window must have an owner (for example, if the client window is a
list box), the application must call the WinSetOwner function to set the
owner of the client window after the call to WinCreateStdWindow.
Example
This example shows a typical initialization function for a window. The
function first registers the window class, then calls WinCreateStdWindow to
create a standard window and returns immediately if the function fails.
Otherwise, it continues on to do other initialization processing.
Note that the FCF_STANDARD constant can be used only if you have defined all
the resources. For example, if you use this constant and you don't have an
accelerator table, the function will fail.
CHAR szClassName[] = "Generic"; /* window class name */
HWND hwndClient; /* handle to the client */
HWND hwndFrame; /* handle to the frame */
BOOL GenericInit()
{
ULONG flStyle;
flStyle = FCF_STANDARD;
if (!WinRegisterClass(hab, szClassName, GenericWndProc, 0L, 0))
return (FALSE);
hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
0L, /* frame-window style */
&flStyle, /* window style */
szClassName, /* class name */
"Generic Application", /* window title */
0L, /* default client style */
NULL, /* resource in executable file */
IDM_RESOURCE, /* resource id */
&hwndClient); /* receives client window handle */
if (!hwndFrame)
return (FALSE);
else {
.
. /* other initialization code */
.
See Also
DosLoadModule, WinCreateWindow, WinQueryDesktopWindow, WinQueryObjectWindow,
WinSetSysModalWindow, WinSetSysValue, WinSetWindowPos, WinSetWindowUShort
♦