Changes between Version 8 and Version 9 of WindowsApi/Instructions
- Timestamp:
- 08/19/13 23:17:08 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WindowsApi/Instructions
v8 v9 28 28 == Constant #defines to enum blocks == 29 29 30 Convert #defines that define integral constants into enum blocks that group the constants logically. If you can determine the appropriate type of the constants (you may need to read the [http://msdn.microsoft.com/ MSDN] documentation to do so), then specify it as the base type of the enum. 31 32 If the enum block so defined contains consecutive values, they do not need to be explicitly specified, as D will automatically assign consecutive values to them .30 Convert #defines that define integral constants into enum blocks that group the constants logically. If you can determine the appropriate type of the constants (you may need to read the [http://msdn.microsoft.com/ MSDN] documentation to do so), then specify it as the base type of the enum. '''RU:''' Always use enum, not const, in order to force inlining. 31 32 If the enum block so defined contains consecutive values, they do not need to be explicitly specified, as D will automatically assign consecutive values to them (with some exceptions such as the HKEY constants defined in winreg.d). 33 33 34 34 Indent the constants within an enum block with one tab character. In each enum block, align the equals signs in a column, using spaces rather than tabs. 53 53 Sometimes in the original headers, a logical group of constants is interrupted with other declarations (e.g. constants related to specific Windows messages). Move these interruptions to below the whole group. 54 54 55 Group constants of non-integer types (e.g. magic values of handles or string pointers), or constants that define bit flags, using a const declaration. Example:56 {{{57 const HKEY58 HKEY_CLASSES_ROOT = cast(HKEY) 0x80000000,59 HKEY_CURRENT_USER = cast(HKEY) 0x80000001,60 HKEY_LOCAL_MACHINE = cast(HKEY) 0x80000002,61 HKEY_USERS = cast(HKEY) 0x80000003,62 HKEY_PERFORMANCE_DATA = cast(HKEY) 0x80000004,63 HKEY_CURRENT_CONFIG = cast(HKEY) 0x80000005,64 HKEY_DYN_DATA = cast(HKEY) 0x80000006;65 }}}66 67 55 == Struct naming == 68 56 97 85 98 86 == Constant pointers == 99 A const pointer declaration, such as 100 {{{ 101 const GUID* pguid; 102 }}} 103 becomes 104 {{{ 105 CPtr!(GUID) pguid; 106 }}} 107 The CPtr template is defined in basetsd.d. This enables the bindings to support both D 1.x and D 2.x. 87 '''RU:''' Declare const pointers D-style, for example 88 {{{ 89 const(GUID)* pguid; 90 }}} 91 Since we are now supporting D2 only, the old CPtr template is no longer used. 108 92 109 93 == COM interfaces == 151 135 Every module that uses this conditional compilation must privately import win32.w32api, which defines the constants used to set the minimum version of Windows an application supports. 152 136 153 '''RU:''' Previously, we based this on two compile-time contstants: _WIN32_WINDOWS and _WIN32_WINNT. Now that Windows 9x is no longer supported either by Microsoft or by DMD, we consider only _WIN32_WINNT, and ignore _WIN32_WINDOWS. 137 '''RU:''' Previously, we based this on two compile-time contstants: _WIN32_WINDOWS and _WIN32_WINNT. Now that Windows 9x is no longer supported either by Microsoft or by DMD, we consider only _WIN32_WINNT, and ignore _WIN32_WINDOWS. Also, any check for _WIN32_WINNT >= 0x500 can be omitted, since we are not supporting anything older than Windows 2000. 154 138 155 139 Rather than relying on the conditionals in the MinGW headers, it is a good idea to look on [http://msdn.microsoft.com/ MSDN] to see which Windows versions support each entity that is CC'd.