annotate win32/w32api.d @ 1:4a9dcbd9e54f

-files of 0.13 beta -fixes so that it now compiles with the current dmd version
author marton@basel.hu
date Tue, 05 Apr 2011 20:44:01 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
1 /***********************************************************************\
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
2 * w32api.d *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
3 * *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
4 * Windows API header module *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
5 * *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
6 * Translated from MinGW API for MS-Windows 3.12 *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
7 * by Stewart Gordon *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
8 * *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
9 * Placed into public domain *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
10 \***********************************************************************/
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
11 module win32.w32api;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
12
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
13 const __W32API_VERSION = 3.12;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
14 const __W32API_MAJOR_VERSION = 3;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
15 const __W32API_MINOR_VERSION = 12;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
16
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
17 /* These version identifiers are used to specify the minimum version of
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
18 * Windows that an application will support.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
19 *
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
20 * The programmer should set two version identifiers: one for the
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
21 * minimum Windows NT version and one for the minimum Windows 9x
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
22 * version. If no Windows NT version is specified, Windows NT 4 is
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
23 * assumed. If no Windows 9x version is specified, Windows 95 is
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
24 * assumed, unless WindowsNTonly, WindowsXP, Windows2003 or WindowsVista
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
25 * is specified, implying that the application supports only the NT line of
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
26 * versions.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
27 */
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
28
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
29 /* For Windows XP and later, assume no Windows 9x support.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
30 * API features new to Windows Vista are not yet included in this
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
31 * translation or in MinGW, but this is here ready to start adding them.
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
32 */
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
33 version (WindowsVista) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
34 const uint
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
35 _WIN32_WINNT = 0x600,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
36 _WIN32_WINDOWS = uint.max;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
37
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
38 } else version (Windows2003) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
39 const uint
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
40 _WIN32_WINNT = 0x502,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
41 _WIN32_WINDOWS = uint.max;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
42
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
43 } else version (WindowsXP) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
44 const uint
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
45 _WIN32_WINNT = 0x501,
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
46 _WIN32_WINDOWS = uint.max;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
47
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
48 } else {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
49 /* for earlier Windows versions, separate version identifiers into
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
50 * the NT and 9x lines
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
51 */
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
52 version (Windows2000) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
53 const uint _WIN32_WINNT = 0x500;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
54 } else {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
55 const uint _WIN32_WINNT = 0x400;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
56 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
57
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
58 version (WindowsNTonly) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
59 const uint _WIN32_WINDOWS = uint.max;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
60 } else version (WindowsME) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
61 const uint _WIN32_WINDOWS = 0x500;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
62 } else version (Windows98) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
63 const uint _WIN32_WINDOWS = 0x410;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
64 } else {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
65 const uint _WIN32_WINDOWS = 0x400;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
66 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
67 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
68
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
69 // Just a bit of syntactic sugar for the static ifs
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
70 const uint WINVER = _WIN32_WINDOWS < _WIN32_WINNT ?
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
71 _WIN32_WINDOWS : _WIN32_WINNT;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
72 const bool _WIN32_WINNT_ONLY = _WIN32_WINDOWS == uint.max;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
73
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
74 version (IE7) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
75 const uint _WIN32_IE = 0x700;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
76 } else version (IE602) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
77 const uint _WIN32_IE = 0x603;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
78 } else version (IE601) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
79 const uint _WIN32_IE = 0x601;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
80 } else version (IE6) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
81 const uint _WIN32_IE = 0x600;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
82 } else version (IE56) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
83 const uint _WIN32_IE = 0x560;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
84 } else version (IE501) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
85 const uint _WIN32_IE = 0x501;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
86 } else version (IE5) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
87 const uint _WIN32_IE = 0x500;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
88 } else version (IE401) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
89 const uint _WIN32_IE = 0x401;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
90 } else version (IE4) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
91 const uint _WIN32_IE = 0x400;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
92 } else version (IE3) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
93 const uint _WIN32_IE = 0x300;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
94 } else static if (WINVER >= 0x410) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
95 const uint _WIN32_IE = 0x400;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
96 } else {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
97 const uint _WIN32_IE = 0;
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
98 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
99
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
100 debug (WindowsUnitTest) {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
101 unittest {
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
102 printf("Windows NT version: %03x\n", _WIN32_WINNT);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
103 printf("Windows 9x version: %03x\n", _WIN32_WINDOWS);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
104 printf("IE version: %03x\n", _WIN32_IE);
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
105 }
4a9dcbd9e54f -files of 0.13 beta
marton@basel.hu
parents:
diff changeset
106 }