File: Window.html

package info (click to toggle)
polyml 5.6-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,892 kB
  • ctags: 34,453
  • sloc: cpp: 44,983; ansic: 24,520; asm: 14,850; sh: 11,730; makefile: 551; exp: 484; python: 253; awk: 91; sed: 9
file content (169 lines) | stat: -rw-r--r-- 6,619 bytes parent folder | download | duplicates (5)
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 -&gt; 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 -&gt; RECT
    val AdjustWindowRectEx :  RECT * Style.flags * bool * int -&gt; RECT
    val ArrangeIconicWindows : HWND -&gt; int
    val BringWindowToTop : HWND -&gt; unit
    val CW_USEDEFAULT : int
    val ChildWindowFromPoint : HWND * POINT -&gt; HWND option
    val CloseWindow : HWND -&gt; 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} -&gt; HWND
    <a
name="DestroyWindow">val DestroyWindow</a>: HWND -&gt; unit
    val FindWindow: string * string option -&gt; HWND
    val FindWindowEx: HWND option * HWND option * string * string option -&gt; HWND
    val GetClassName : HWND -&gt; string
    val GetClientRect : HWND -&gt; RECT
    val GetDesktopWindow : unit -&gt; HWND
    val GetForegroundWindow : unit -&gt; HWND
    val GetLastActivePopup : HWND -&gt; HWND
    val GetNextWindow : HWND * GetWindowFlags -&gt; HWND
    val GetParent : HWND -&gt; HWND option
    val GetTopWindow : HWND option-&gt; HWND option
    val GetWindow : HWND * GetWindowFlags -&gt; HWND option
    val GetWindowContextHelpId : HWND -&gt; int
    val GetWindowLong : HWND * int -&gt; int
    val GetWindowRect : HWND -&gt; RECT
    val <a
name="GetWindowText">GetWindowText</a> : HWND -&gt; string
    val GetWindowTextLength : HWND -&gt; int
    val IsChild : HWND * HWND -&gt; bool
    val IsIconic : HWND -&gt; bool
    val IsWindow : HWND -&gt; bool
    val IsWindowVisible : HWND -&gt; bool
    val IsZoomed : HWND -&gt; bool
    <a
name="MoveWindow">val MoveWindow</a> : {x: int, y: int, hWnd: HWND, width: int, height: int, repaint: bool} -&gt; unit
    val OpenIcon : HWND -&gt; unit
    val SetForegroundWindow : HWND -&gt; bool
    val <a
name="SetParent">SetParent</a> : HWND * HWND option -&gt; HWND
    val SetWindowContextHelpId : HWND * int -&gt; unit
    val SetWindowLong : HWND * int * int -&gt; int
    val SetWindowPos : HWND * HWND * int * int * int * int * WindowPositionStyle list -&gt; unit
    val SetWindowText : HWND * string -&gt; unit
    val SubclassWindow :
       HWND *
       (HWND * Message.Message * 'a -&gt; Message.LRESULT option * 'a) * 'a -&gt; unit
    val WindowFromPoint : POINT -&gt; HWND option
end</pre>

<p><tt>datatype <a name="ParentType">ParentType</a> = ChildWindow of {id: int, parent:
HWND} | PopupWindow of HMENU &nbsp; |&nbsp; PopupWithClassMenu</tt><br>
The ParentType datatype is used as one of the arguments to CreateWindow.&nbsp;
PopupWithClassMenu and PopupWindow both create top-level windows.&nbsp; PopupWindow
provides a menu to be used whereas PopupWithClassMenu uses the menu, if any, given when
the class was created.&nbsp; ChildWindow creates a child of the given parent window and
provides an id for the child.&nbsp; All children must have different identifiers. &nbsp;
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>&nbsp;</p>

<h4>Subclassing</h4>

<p>It is possible to replace a window procedure for a window by <em>subclassing</em> the
window.&nbsp; 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.&nbsp; 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).&nbsp; 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>