1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Windows Interface Reference: Window structure</title>
</head>
<body>
<h1>Window </h1>
<p>The Window structure contains functions and structures to create and operate on
windows. Many other operations are available by sending messages to windows.</p>
<pre>structure Window :
sig
type HWND and HINSTANCE and HMENU
type POINT = { x: int, y: int }
type RECT = { left: int, top: int, right: int, bottom: int }
structure Style:
sig
include BIT_FLAGS
val WS_OVERLAPPED: flags and WS_POPUP: flags and WS_CHILD: flags and WS_MINIMIZE: flags
and WS_VISIBLE: flags and WS_DISABLED:flags and WS_CLIPSIBLINGS:flags
and WS_CLIPCHILDREN:flags and WS_MAXIMIZE:flags and WS_CAPTION:flags
and WS_BORDER:flags and WS_DLGFRAME:flags and WS_VSCROLL:flags and WS_HSCROLL:flags
and WS_SYSMENU:flags and WS_THICKFRAME:flags and WS_GROUP:flags and WS_TABSTOP:flags
and WS_MINIMIZEBOX:flags and WS_MAXIMIZEBOX:flags and WS_TILED:flags and WS_ICONIC:flags
and WS_SIZEBOX:flags and WS_OVERLAPPEDWINDOW:flags and WS_TILEDWINDOW:flags
and WS_POPUPWINDOW:flags and WS_CHILDWINDOW:flags
end
datatype WindowPositionStyle =
SWP_ASYNCWINDOWPOS
| SWP_DEFERERASE
| SWP_FRAMECHANGED
| SWP_HIDEWINDOW
| SWP_NOACTIVATE
| SWP_NOCOPYBITS
| SWP_NOMOVE
| SWP_NOOWNERZORDER
| SWP_NOREDRAW
| SWP_NOSENDCHANGING
| SWP_NOSIZE
| SWP_NOZORDER
| SWP_SHOWWINDOW
| SWP_OTHER of int
datatype ShowWindowOptions =
SW_HIDE
| SW_MAXIMIZE
| SW_MINIMIZE
| SW_RESTORE
| SW_SHOW
| SW_SHOWDEFAULT
| SW_SHOWMAXIMIZED
| SW_SHOWMINIMIZED
| SW_SHOWMINNOACTIVE
| SW_SHOWNA
| SW_SHOWNOACTIVATE
| SW_SHOWNORMAL
val SW_NORMAL: ShowWindowOptions
val SW_MAX: ShowWindowOptions
val ShowWindow: HWND * ShowWindowOptions -> bool
datatype GetWindowFlags =
GW_CHILD
| GW_HWNDFIRST
| GW_HWNDLAST
| GW_HWNDNEXT
| GW_HWNDPREV
| GW_OWNER
datatype <a
href="#ParentType">ParentType</a> =
ChildWindow of {id: int, parent: HWND}
| PopupWindow of HMENU
| PopupWithClassMenu
val GWL_EXSTYLE : int
val GWL_HINSTANCE : int
val GWL_HWNDPARENT : int
val GWL_ID : int
val GWL_STYLE : int
val GWL_USERDATA : int
val AdjustWindowRect : RECT * Style.flags * bool -> RECT
val AdjustWindowRectEx : RECT * Style.flags * bool * int -> RECT
val ArrangeIconicWindows : HWND -> int
val BringWindowToTop : HWND -> unit
val CW_USEDEFAULT : int
val ChildWindowFromPoint : HWND * POINT -> HWND option
val CloseWindow : HWND -> unit
<a
name="CreateWindow">val CreateWindow</a> :
{x: int, y: int, init: 'a, name: string, class: 'a Class.ATOM,
style: Style.flags, width: int, height: int,
instance: HINSTANCE, relation: ParentType} -> HWND
<a
name="DestroyWindow">val DestroyWindow</a>: HWND -> unit
val FindWindow: string * string option -> HWND
val FindWindowEx: HWND option * HWND option * string * string option -> HWND
val GetClassName : HWND -> string
val GetClientRect : HWND -> RECT
val GetDesktopWindow : unit -> HWND
val GetForegroundWindow : unit -> HWND
val GetLastActivePopup : HWND -> HWND
val GetNextWindow : HWND * GetWindowFlags -> HWND
val GetParent : HWND -> HWND option
val GetTopWindow : HWND option-> HWND option
val GetWindow : HWND * GetWindowFlags -> HWND option
val GetWindowContextHelpId : HWND -> int
val GetWindowLong : HWND * int -> int
val GetWindowRect : HWND -> RECT
val <a
name="GetWindowText">GetWindowText</a> : HWND -> string
val GetWindowTextLength : HWND -> int
val IsChild : HWND * HWND -> bool
val IsIconic : HWND -> bool
val IsWindow : HWND -> bool
val IsWindowVisible : HWND -> bool
val IsZoomed : HWND -> bool
<a
name="MoveWindow">val MoveWindow</a> : {x: int, y: int, hWnd: HWND, width: int, height: int, repaint: bool} -> unit
val OpenIcon : HWND -> unit
val SetForegroundWindow : HWND -> bool
val <a
name="SetParent">SetParent</a> : HWND * HWND option -> HWND
val SetWindowContextHelpId : HWND * int -> unit
val SetWindowLong : HWND * int * int -> int
val SetWindowPos : HWND * HWND * int * int * int * int * WindowPositionStyle list -> unit
val SetWindowText : HWND * string -> unit
val SubclassWindow :
HWND *
(HWND * Message.Message * 'a -> Message.LRESULT option * 'a) * 'a -> unit
val WindowFromPoint : POINT -> HWND option
end</pre>
<p><tt>datatype <a name="ParentType">ParentType</a> = ChildWindow of {id: int, parent:
HWND} | PopupWindow of HMENU | PopupWithClassMenu</tt><br>
The ParentType datatype is used as one of the arguments to CreateWindow.
PopupWithClassMenu and PopupWindow both create top-level windows. PopupWindow
provides a menu to be used whereas PopupWithClassMenu uses the menu, if any, given when
the class was created. ChildWindow creates a child of the given parent window and
provides an id for the child. All children must have different identifiers.
The identifier is used in <a href="Message.html#WM_NOTIFY">WM_NOTIFY</a> messages to
notify the parent about changes in the child and can be used to find a child window from
the parent using <a href="Dialog.html#GetDlgItem">GetDlgItem</a>. </p>
<p> </p>
<h4>Subclassing</h4>
<p>It is possible to replace a window procedure for a window by <em>subclassing</em> the
window. This is useful where a window is required which is almost the same as, say
an Edit window, but it needs to process a few messages in a special way. A new
window procedure is installed which process the particular messages but calls the original
window procedure for any of the others.</p>
<p>(The terminology is, in my opinion confusing: subclassing a window does not create a
new class of window but changes only a single window). In C this is done using the
SetWindowLong function: in ML there is a SubclassWindow function which does this and
automatically calls the window procedure of the base class for any messages which are not
otherwise processed.</p>
</body>
</html>
|