comparison R/scratch/win32.R @ 0:0cfcc391201f

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:26:28 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0cfcc391201f
1 # ----------------------------------------------------------------------------
2 # constants
3
4 CS_BYTEALIGNCLIENT = 4096
5 CS_BYTEALIGNWINDOW = 8192
6 CS_CLASSDC = 64
7 CS_DBLCLKS = 8
8 CS_DELETE_TRANSFORM = 0x00000003
9 CS_DISABLE = 0x00000002
10 CS_ENABLE = 0x00000001
11 CS_GLOBALCLASS = 16384
12 CS_HREDRAW = 2
13 CS_IME = 0x10000
14 CS_INSERTCHAR = 0x2000
15 CS_KEYCVTWINDOW = 4
16 CS_NOCLOSE = 512
17 CS_NOKEYCVT = 256
18 CS_NOMOVECARET = 0x4000
19 CS_OWNDC = 32
20 CS_PARENTDC = 128
21 CS_SAVEBITS = 2048
22 CS_VREDRAW = 1
23 WM_USER = 1024
24 WM_ACTIVATE = 6
25 WM_ACTIVATEAPP = 28
26 WM_AFXFIRST = 864
27 WM_AFXLAST = 895
28 WM_APP = 32768
29 WM_ASKCBFORMATNAME = 780
30 WM_CANCELJOURNAL = 75
31 WM_CANCELMODE = 31
32 WM_CAPTURECHANGED = 533
33 WM_CHANGECBCHAIN = 781
34 WM_CHAR = 258
35 WM_CHARTOITEM = 47
36 WM_CHILDACTIVATE = 34
37 WM_CHOOSEFONT_GETLOGFONT = (WM_USER+1)
38 WM_CHOOSEFONT_SETFLAGS = (WM_USER+102)
39 WM_CHOOSEFONT_SETLOGFONT = (WM_USER+101)
40 WM_CLEAR = 771
41 WM_CLOSE = 16
42 WM_COMMAND = 273
43 WM_COMMNOTIFY = 68
44 WM_COMPACTING = 65
45 WM_COMPAREITEM = 57
46 WM_CONTEXTMENU = 123
47 WM_CONVERTREQUESTEX = 0x108
48 WM_COPY = 769
49 WM_COPYDATA = 74
50 WM_CREATE = 1
51 WM_CTLCOLORBTN = 309
52 WM_CTLCOLORDLG = 310
53 WM_CTLCOLOREDIT = 307
54 WM_CTLCOLORLISTBOX = 308
55 WM_CTLCOLORMSGBOX = 306
56 WM_CTLCOLORSCROLLBAR = 311
57 WM_CTLCOLORSTATIC = 312
58 WM_CUT = 768
59 WM_DDE_FIRST = 0x03E0
60 WM_DDE_ACK = (WM_DDE_FIRST+4)
61 WM_DDE_ADVISE = (WM_DDE_FIRST+2)
62 WM_DDE_DATA = (WM_DDE_FIRST+5)
63 WM_DDE_EXECUTE = (WM_DDE_FIRST+8)
64 WM_DDE_INITIATE = (WM_DDE_FIRST)
65 WM_DDE_LAST = (WM_DDE_FIRST+8)
66 WM_DDE_POKE = (WM_DDE_FIRST+7)
67 WM_DDE_REQUEST = (WM_DDE_FIRST+6)
68 WM_DDE_TERMINATE = (WM_DDE_FIRST+1)
69 WM_DDE_UNADVISE = (WM_DDE_FIRST+3)
70 WM_DEADCHAR = 259
71 WM_DELETEITEM = 45
72 WM_DESTROY = 2
73 WM_DESTROYCLIPBOARD = 775
74 WM_DEVICECHANGE = 537
75 WM_DEVMODECHANGE = 27
76 WM_DISPLAYCHANGE = 126
77 WM_DRAWCLIPBOARD = 776
78 WM_DRAWITEM = 43
79 WM_DROPFILES = 563
80 WM_ENABLE = 10
81 WM_ENDSESSION = 22
82 WM_ENTERIDLE = 289
83 WM_ENTERMENULOOP = 529
84 WM_ENTERSIZEMOVE = 561
85 WM_ERASEBKGND = 20
86 WM_EXITMENULOOP = 530
87 WM_EXITSIZEMOVE = 562
88 WM_FONTCHANGE = 29
89 WM_GETDLGCODE = 135
90 WM_GETFONT = 49
91 WM_GETHOTKEY = 51
92 WM_GETICON = 127
93 WM_GETMINMAXINFO = 36
94 WM_GETTEXT = 13
95 WM_GETTEXTLENGTH = 14
96 WM_HANDHELDFIRST = 856
97 WM_HANDHELDLAST = 863
98 WM_HELP = 83
99 WM_HOTKEY = 786
100 WM_HSCROLL = 276
101 WM_HSCROLLCLIPBOARD = 782
102 WM_ICONERASEBKGND = 39
103 WM_IME_CHAR = 0x286
104 WM_IME_COMPOSITION = 0x10F
105 WM_IME_COMPOSITIONFULL = 0x284
106 WM_IME_CONTROL = 0x283
107 WM_IME_ENDCOMPOSITION = 0x10E
108 WM_IME_KEYDOWN = 0x290
109 WM_IME_KEYLAST = 0x10F
110 WM_IME_KEYUP = 0x291
111 WM_IME_NOTIFY = 0x282
112 WM_IME_SELECT = 0x285
113 WM_IME_SETCONTEXT = 0x281
114 WM_IME_STARTCOMPOSITION = 0x10D
115 WM_INITDIALOG = 272
116 WM_INITMENU = 278
117 WM_INITMENUPOPUP = 279
118 WM_INPUTLANGCHANGE = 81
119 WM_INPUTLANGCHANGEREQUEST = 80
120 WM_KEYDOWN = 256
121 WM_KEYFIRST = 256
122 WM_KEYLAST = 264
123 WM_KEYUP = 257
124 WM_KILLFOCUS = 8
125 WM_LBUTTONDBLCLK = 515
126 WM_LBUTTONDOWN = 513
127 WM_LBUTTONUP = 514
128 WM_MBUTTONDBLCLK = 521
129 WM_MBUTTONDOWN = 519
130 WM_MBUTTONUP = 520
131 WM_MDIACTIVATE = 546
132 WM_MDICASCADE = 551
133 WM_MDICREATE = 544
134 WM_MDIDESTROY = 545
135 WM_MDIGETACTIVE = 553
136 WM_MDIICONARRANGE = 552
137 WM_MDIMAXIMIZE = 549
138 WM_MDINEXT = 548
139 WM_MDIREFRESHMENU = 564
140 WM_MDIRESTORE = 547
141 WM_MDISETMENU = 560
142 WM_MDITILE = 550
143 WM_MEASUREITEM = 44
144 WM_MENUCHAR = 288
145 WM_MENUSELECT = 287
146 WM_MOUSEACTIVATE = 33
147 WM_MOUSEFIRST = 512
148 WM_MOUSEHOVER = 0x2A1
149 WM_MOUSELAST = 522
150 WM_MOUSELEAVE = 0x2A3
151 WM_MOUSEMOVE = 512
152 WM_MOUSEWHEEL = 522
153 WM_MOVE = 3
154 WM_MOVING = 534
155 WM_NCACTIVATE = 134
156 WM_NCCALCSIZE = 131
157 WM_NCCREATE = 129
158 WM_NCDESTROY = 130
159 WM_NCHITTEST = 132
160 WM_NCLBUTTONDBLCLK = 163
161 WM_NCLBUTTONDOWN = 161
162 WM_NCLBUTTONUP = 162
163 WM_NCMBUTTONDBLCLK = 169
164 WM_NCMBUTTONDOWN = 167
165 WM_NCMBUTTONUP = 168
166 WM_NCMOUSEMOVE = 160
167 WM_NCPAINT = 133
168 WM_NCRBUTTONDBLCLK = 166
169 WM_NCRBUTTONDOWN = 164
170 WM_NCRBUTTONUP = 165
171 WM_NEXTDLGCTL = 40
172 WM_NEXTMENU = 531
173 WM_NOTIFY = 78
174 WM_NOTIFYFORMAT = 85
175 WM_NULL = 0
176 WM_PAINT = 15
177 WM_PAINTCLIPBOARD = 777
178 WM_PAINTICON = 38
179 WM_PALETTECHANGED = 785
180 WM_PALETTEISCHANGING = 784
181 WM_PARENTNOTIFY = 528
182 WM_PASTE = 770
183 WM_PENWINFIRST = 896
184 WM_PENWINLAST = 911
185 WM_POWER = 72
186 WM_POWERBROADCAST = 536
187 WM_PRINT = 791
188 WM_PRINTCLIENT = 792
189 WM_PSD_ENVSTAMPRECT = (WM_USER+5)
190 WM_PSD_FULLPAGERECT = (WM_USER+1)
191 WM_PSD_GREEKTEXTRECT = (WM_USER+4)
192 WM_PSD_MARGINRECT = (WM_USER+3)
193 WM_PSD_MINMARGINRECT = (WM_USER+2)
194 WM_PSD_PAGESETUPDLG = WM_USER
195 WM_PSD_YAFULLPAGERECT = (WM_USER+6)
196 WM_QUERYDRAGICON = 55
197 WM_QUERYENDSESSION = 17
198 WM_QUERYNEWPALETTE = 783
199 WM_QUERYOPEN = 19
200 WM_QUEUESYNC = 35
201 WM_QUIT = 18
202 WM_RBUTTONDBLCLK = 518
203 WM_RBUTTONDOWN = 516
204 WM_RBUTTONUP = 517
205 WM_RENDERALLFORMATS = 774
206 WM_RENDERFORMAT = 773
207 WM_SETCURSOR = 32
208 WM_SETFOCUS = 7
209 WM_SETFONT = 48
210 WM_SETHOTKEY = 50
211 WM_SETICON = 128
212 WM_SETREDRAW = 11
213 WM_SETTEXT = 12
214 WM_SETTINGCHANGE = 26
215 WM_SHOWWINDOW = 24
216 WM_SIZE = 5
217 WM_SIZECLIPBOARD = 779
218 WM_SIZING = 532
219 WM_SPOOLERSTATUS = 42
220 WM_STYLECHANGED = 125
221 WM_STYLECHANGING = 124
222 WM_SYNCPAINT = 136
223 WM_SYSCHAR = 262
224 WM_SYSCOLORCHANGE = 21
225 WM_SYSCOMMAND = 274
226 WM_SYSDEADCHAR = 263
227 WM_SYSKEYDOWN = 260
228 WM_SYSKEYUP = 261
229 WM_TCARD = 82
230 WM_THEMECHANGED = 794
231 WM_TIMECHANGE = 30
232 WM_TIMER = 275
233 WM_UNDO = 772
234 WM_USERCHANGED = 84
235 WM_VKEYTOITEM = 46
236 WM_VSCROLL = 277
237 WM_VSCROLLCLIPBOARD = 778
238 WM_WINDOWPOSCHANGED = 71
239 WM_WINDOWPOSCHANGING = 70
240 WM_WININICHANGE = 26
241 WS_ACTIVECAPTION = 0x00000001
242 WS_BORDER = 0x800000
243 WS_CAPTION = 0xc00000
244 WS_CHILD = 0x40000000
245 WS_CHILDWINDOW = 0x40000000
246 WS_CLIPCHILDREN = 0x2000000
247 WS_CLIPSIBLINGS = 0x4000000
248 WS_DISABLED = 0x8000000
249 WS_DLGFRAME = 0x400000
250 WS_EX_ACCEPTFILES = 16
251 WS_EX_APPWINDOW = 0x40000
252 WS_EX_CLIENTEDGE = 512
253 WS_EX_COMPOSITED = 0x2000000
254 WS_EX_CONTEXTHELP = 0x400
255 WS_EX_CONTROLPARENT = 0x10000
256 WS_EX_DLGMODALFRAME = 1
257 WS_EX_LAYERED = 0x80000
258 WS_EX_LAYOUTRTL = 0x400000
259 WS_EX_LEFT = 0
260 WS_EX_LEFTSCROLLBAR = 0x4000
261 WS_EX_LTRREADING = 0
262 WS_EX_MDICHILD = 64
263 WS_EX_NOACTIVATE = 0x8000000
264 WS_EX_NOINHERITLAYOUT = 0x100000
265 WS_EX_NOPARENTNOTIFY = 4
266 WS_EX_OVERLAPPEDWINDOW = 0x300
267 WS_EX_PALETTEWINDOW = 0x188
268 WS_EX_RIGHT = 0x1000
269 WS_EX_RIGHTSCROLLBAR = 0
270 WS_EX_RTLREADING = 0x2000
271 WS_EX_STATICEDGE = 0x20000
272 WS_EX_TOOLWINDOW = 128
273 WS_EX_TOPMOST = 8
274 WS_EX_TRANSPARENT = 32
275 WS_EX_WINDOWEDGE = 256
276 WS_GROUP = 0x20000
277 WS_HSCROLL = 0x100000
278 WS_ICONIC = 0x20000000
279 WS_MAXIMIZE = 0x1000000
280 WS_MAXIMIZEBOX = 0x10000
281 WS_MINIMIZE = 0x20000000
282 WS_MINIMIZEBOX = 0x20000
283 WS_OVERLAPPED = 0
284 WS_OVERLAPPEDWINDOW = 0xcf0000
285 WS_POPUP = 0x80000000
286 WS_POPUPWINDOW = 0x80880000
287 WS_SIZEBOX = 0x40000
288 WS_SYSMENU = 0x80000
289 WS_TABSTOP = 0x10000
290 WS_THICKFRAME = 0x40000
291 WS_TILED = 0
292 WS_TILEDWINDOW = 0xcf0000
293 WS_VISIBLE = 0x10000000
294 WS_VSCROLL = 0x200000
295 SM_ARRANGE = 56
296 SM_CLEANBOOT = 67
297 SM_CMETRICS = 88
298 SM_CMONITORS = 80
299 SM_CMOUSEBUTTONS = 43
300 SM_CXBORDER = 5
301 SM_CXCURSOR = 13
302 SM_CXDLGFRAME = 7
303 SM_CXDOUBLECLK = 36
304 SM_CXDRAG = 68
305 SM_CXEDGE = 45
306 SM_CXFIXEDFRAME = 7
307 SM_CXFOCUSBORDER = 83
308 SM_CXFRAME = 32
309 SM_CXFULLSCREEN = 16
310 SM_CXHSCROLL = 21
311 SM_CXHTHUMB = 10
312 SM_CXICON = 11
313 SM_CXICONSPACING = 38
314 SM_CXMAXIMIZED = 61
315 SM_CXMAXTRACK = 59
316 SM_CXMENUCHECK = 71
317 SM_CXMENUSIZE = 54
318 SM_CXMIN = 28
319 SM_CXMINIMIZED = 57
320 SM_CXMINSPACING = 47
321 SM_CXMINTRACK = 34
322 SM_CXSCREEN = 0
323 SM_CXSIZE = 30
324 SM_CXSIZEFRAME = 32
325 SM_CXSMICON = 49
326 SM_CXSMSIZE = 52
327 SM_CXVIRTUALSCREEN = 78
328 SM_CXVSCROLL = 2
329 SM_CYBORDER = 6
330 SM_CYCAPTION = 4
331 SM_CYCURSOR = 14
332 SM_CYDLGFRAME = 8
333 SM_CYDOUBLECLK = 37
334 SM_CYDRAG = 69
335 SM_CYEDGE = 46
336 SM_CYFIXEDFRAME = 8
337 SM_CYFOCUSBORDER = 84
338 SM_CYFRAME = 33
339 SM_CYFULLSCREEN = 17
340 SM_CYHSCROLL = 3
341 SM_CYICON = 12
342 SM_CYICONSPACING = 39
343 SM_CYKANJIWINDOW = 18
344 SM_CYMAXIMIZED = 62
345 SM_CYMAXTRACK = 60
346 SM_CYMENU = 15
347 SM_CYMENUCHECK = 72
348 SM_CYMENUSIZE = 55
349 SM_CYMIN = 29
350 SM_CYMINIMIZED = 58
351 SM_CYMINSPACING = 48
352 SM_CYMINTRACK = 35
353 SM_CYSCREEN = 1
354 SM_CYSIZE = 31
355 SM_CYSIZEFRAME = 33
356 SM_CYSMCAPTION = 51
357 SM_CYSMICON = 50
358 SM_CYSMSIZE = 53
359 SM_CYVIRTUALSCREEN = 79
360 SM_CYVSCROLL = 20
361 SM_CYVTHUMB = 9
362 SM_DBCSENABLED = 42
363 SM_DEBUG = 22
364 SM_IMMENABLED = 82
365 SM_MEDIACENTER = 87
366 SM_MENUDROPALIGNMENT = 40
367 SM_MIDEASTENABLED = 74
368 SM_MOUSEPRESENT = 19
369 SM_MOUSEWHEELPRESENT = 75
370 SM_NETWORK = 63
371 SM_PENWINDOWS = 41
372 SM_REMOTESESSION = 0X1000
373 SM_RESERVED1 = 24
374 SM_RESERVED2 = 25
375 SM_RESERVED3 = 26
376 SM_RESERVED4 = 27
377 SM_SAMEDISPLAYFORMAT = 81
378 SM_SECURE = 44
379 SM_SERVERR2 = 89
380 SM_SHOWSOUNDS = 70
381 SM_SLOWMACHINE = 73
382 SM_STARTER = 88
383 SM_SWAPBUTTON = 23
384 SM_TABLETPC = 86
385 SM_XVIRTUALSCREEN = 76
386 SM_YVIRTUALSCREEN = 77
387 AF_12844 = 25
388 AF_APPLETALK = 16
389 AF_ATM = 22
390 AF_BAN = 21
391 AF_CCITT = 10
392 AF_CHAOS = 5
393 AF_CLUSTER = 24
394 AF_DATAKIT = 9
395 AF_DECnet = 12
396 AF_DLI = 13
397 AF_ECMA = 8
398 AF_FIREFOX = 19
399 AF_HYLINK = 15
400 AF_IMPLINK = 3
401 AF_INET = 2
402 AF_INET6 = 23
403 AF_IPX = 6
404 AF_IRDA = 26
405 AF_ISO = 7
406 AF_LAT = 14
407 AF_MAX = 29
408 AF_NETBIOS = 17
409 AF_NETDES = 28
410 AF_NS = 6
411 AF_OSI = AF_ISO
412 AF_PUP = 4
413 AF_SNA = 11
414 AF_UNIX = 1
415 AF_UNKNOWN1 = 20
416 AF_UNSPEC = 0
417 AF_VOICEVIEW = 18
418 COLOR_3DDKSHADOW = 21
419 COLOR_3DFACE = 15
420 COLOR_3DHIGHLIGHT = 20
421 COLOR_3DHILIGHT = 20
422 COLOR_3DLIGHT = 22
423 COLOR_3DSHADOW = 16
424 COLOR_ACTIVEBORDER = 10
425 COLOR_ACTIVECAPTION = 2
426 COLOR_ADJ_MAX = 100
427 COLOR_ADJ_MIN = (-100)
428 COLOR_APPWORKSPACE = 12
429 COLOR_BACKGROUND = 1
430 COLOR_BTNFACE = 15
431 COLOR_BTNHIGHLIGHT = 20
432 COLOR_BTNHILIGHT = 20
433 COLOR_BTNSHADOW = 16
434 COLOR_BTNTEXT = 18
435 COLOR_CAPTIONTEXT = 9
436 COLOR_DESKTOP = 1
437 COLOR_GRADIENTACTIVECAPTION = 27
438 COLOR_GRADIENTINACTIVECAPTION = 28
439 COLOR_GRAYTEXT = 17
440 COLOR_HIGHLIGHT = 13
441 COLOR_HIGHLIGHTTEXT = 14
442 COLOR_HOTLIGHT = 26
443 COLOR_INACTIVEBORDER = 11
444 COLOR_INACTIVECAPTION = 3
445 COLOR_INACTIVECAPTIONTEXT = 19
446 COLOR_INFOBK = 24
447 COLOR_INFOTEXT = 23
448 COLOR_MENU = 4
449 COLOR_MENUTEXT = 7
450 COLOR_SCROLLBAR = 0
451 COLOR_WINDOW = 5
452 COLOR_WINDOWFRAME = 6
453 COLOR_WINDOWTEXT = 8
454 # ----------------------------------------------------------------------------
455 # types
456
457 types <- c(
458 UINT='i',
459 WNDPROC='p',
460 int='i',
461 HINSTANCE='p',
462 HICON='p',
463 HCURSOR='p',
464 HBRUSH='p',
465 LPCTSTR='S',
466 LPCTSTR='S',
467 void='v'
468 )
469
470 # ----------------------------------------------------------------------------
471 # structures
472
473 WNDCLASSEXA <- structinfo("
474 UINT cbSize;
475 UINT style;
476 WNDPROC lpfnWndProc;
477 int cbClsExtra;
478 int cbWndExtra;
479 HINSTANCE hInstance;
480 HICON hIcon;
481 HCURSOR hCursor;
482 HBRUSH hbrBackground;
483 LPCTSTR lpszMenuName;
484 LPCTSTR lpszClassName;
485 HICON hIconSm;
486 ", types)
487
488 # ----------------------------------------------------------------------------
489 # functions
490
491 .kernel32 <- dynbind("kernel32","
492 GetTickCount()i;
493 GetLastError()i;
494 ",callmode="stdcall")
495
496 .user32 <- dynbind("user32","
497 RegisterClassExA(p)n;
498 CreateWindowExA(iSSiiiiipppp)p;
499 DefWindowProcA(pppp)p;
500 ",callmode="stdcall")
501
502