1 /** 2 * Windows API header module 3 * 4 * Translated from MinGW Windows headers 5 * 6 * Authors: Stewart Gordon 7 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 8 * Source: $(DRUNTIMESRC core/sys/windows/_dde.d) 9 */ 10 /// Automatically imported and edited from the druntime module 11 /// core.sys.windows.dde for the auto-generated win32 package. 12 module win32.dde; 13 //version (Windows): 14 @system: 15 version (Win32_UseLib) pragma(lib, "user32"); 16 17 import win32.windef; 18 19 enum : uint { 20 WM_DDE_FIRST = 0x03E0, 21 WM_DDE_INITIATE = WM_DDE_FIRST, 22 WM_DDE_TERMINATE, 23 WM_DDE_ADVISE, 24 WM_DDE_UNADVISE, 25 WM_DDE_ACK, 26 WM_DDE_DATA, 27 WM_DDE_REQUEST, 28 WM_DDE_POKE, 29 WM_DDE_EXECUTE, 30 WM_DDE_LAST = WM_DDE_EXECUTE 31 } 32 33 struct DDEACK { 34 ubyte bAppReturnCode; 35 ubyte _bf; 36 37 @property ubyte reserved() { return cast(ubyte) (_bf & 0x3F); } 38 @property bool fBusy() { return cast(bool) (_bf & 0x40); } 39 @property bool fAck() { return cast(bool) (_bf & 0x80); } 40 41 @property ubyte reserved(ubyte r) { 42 _bf = cast(ubyte) ((_bf & ~0x3F) | (r & 0x3F)); 43 return cast(ubyte)(r & 0x3F); 44 } 45 46 @property bool fBusy(bool f) { _bf = cast(ubyte) ((_bf & ~0x40) | (f << 6)); return f; } 47 @property bool fAck(bool f) { _bf = cast(ubyte) ((_bf & ~0x80) | (f << 7)); return f; } 48 } 49 50 struct DDEADVISE { 51 ushort _bf; 52 short cfFormat; 53 54 @property ushort reserved() { return cast(ushort) (_bf & 0x3FFF); } 55 @property bool fDeferUpd() { return cast(bool) (_bf & 0x4000); } 56 @property bool fAckReq() { return cast(bool) (_bf & 0x8000); } 57 58 @property ushort reserved(ushort r) { 59 _bf = cast(ushort) ((_bf & ~0x3FFF) | (r & 0x3FFF)); 60 return cast(ushort)(r & 0x3FFF); 61 } 62 63 @property bool fDeferUpd(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 14)); return f; } 64 @property bool fAckReq(bool f) { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 15)); return f; } 65 } 66 67 struct DDEDATA { 68 ushort _bf; 69 short cfFormat; 70 byte _Value; 71 72 @property ushort unused() { return cast(ushort) (_bf & 0x0FFF); } 73 @property bool fResponse() { return cast(bool) (_bf & 0x1000); } 74 @property bool fRelease() { return cast(bool) (_bf & 0x2000); } 75 @property bool reserved() { return cast(bool) (_bf & 0x4000); } 76 @property bool fAckReq() { return cast(bool) (_bf & 0x8000); } 77 78 @property byte* Value() return { return &_Value; } 79 80 @property ushort unused(ushort r) { 81 _bf = cast(ushort) ((_bf & ~0x0FFF) | (r & 0x0FFF)); 82 return cast(ushort)(r & 0x0FFF); 83 } 84 85 @property bool fResponse(bool f) { _bf = cast(ushort) ((_bf & ~0x1000) | (f << 12)); return f; } 86 @property bool fRelease(bool f) { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 13)); return f; } 87 @property bool reserved(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 14)); return f; } 88 @property bool fAckReq(bool f) { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 15)); return f; } 89 } 90 91 struct DDEPOKE { 92 ushort _bf; 93 short cfFormat; 94 byte _Value; 95 96 @property ushort unused() { return cast(ushort) (_bf & 0x1FFF); } 97 @property bool fRelease() { return cast(bool) (_bf & 0x2000); } 98 @property ubyte fReserved() { return cast(ubyte) ((_bf & 0xC000) >>> 14); } 99 100 @property byte* Value() return { return &_Value; } 101 102 @property ushort unused(ushort u) { 103 _bf = cast(ushort) ((_bf & ~0x1FFF) | (u & 0x1FFF)); 104 return cast(ushort)(u & 0x1FFF); 105 } 106 107 @property bool fRelease(bool f) { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 13)); return f; } 108 @property ubyte fReserved(ubyte r) { _bf = cast(ushort) ((_bf & ~0xC000) | (r << 14)); return r; } 109 } 110 111 deprecated struct DDELN { 112 ushort _bf; 113 short cfFormat; 114 115 @property ushort unused() { return cast(ushort) (_bf & 0x1FFF); } 116 @property bool fRelease() { return cast(bool) (_bf & 0x2000); } 117 @property bool fDeferUpd() { return cast(bool) (_bf & 0x4000); } 118 @property bool fAckReq() { return cast(bool) (_bf & 0x8000); } 119 120 @property ushort unused(ushort u) { 121 _bf = cast(ushort)((_bf & ~0x1FFF) | (u & 0x1FFF)); 122 return cast(ushort)(u & 0x1FFF); 123 } 124 125 @property bool fRelease(bool f) { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 13)); return f; } 126 @property bool fDeferUpd(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 14)); return f; } 127 @property bool fAckReq(bool f) { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 15)); return f; } 128 } 129 130 deprecated struct DDEUP { 131 ushort _bf; 132 short cfFormat; 133 byte _rgb; 134 135 @property ushort unused() { return cast(ushort) (_bf & 0x0FFF); } 136 @property bool fAck() { return cast(bool) (_bf & 0x1000); } 137 @property bool fRelease() { return cast(bool) (_bf & 0x2000); } 138 @property bool fReserved() { return cast(bool) (_bf & 0x4000); } 139 @property bool fAckReq() { return cast(bool) (_bf & 0x8000); } 140 141 @property byte* rgb() return { return &_rgb; } 142 143 @property ushort unused(ushort r) { 144 _bf = cast(ushort) ((_bf & ~0x0FFF) | (r & 0x0FFF)); 145 return cast(ushort)(r & 0x0FFF); 146 } 147 148 @property bool fAck(bool f) { _bf = cast(ushort) ((_bf & ~0x1000) | (f << 12)); return f; } 149 @property bool fRelease(bool f) { _bf = cast(ushort) ((_bf & ~0x2000) | (f << 13)); return f; } 150 @property bool fReserved(bool f) { _bf = cast(ushort) ((_bf & ~0x4000) | (f << 14)); return f; } 151 @property bool fAckReq(bool f) { _bf = cast(ushort) ((_bf & ~0x8000) | (f << 15)); return f; } 152 } 153 154 extern (Windows) { 155 BOOL DdeSetQualityOfService(HWND, const(SECURITY_QUALITY_OF_SERVICE)*, 156 PSECURITY_QUALITY_OF_SERVICE); 157 BOOL ImpersonateDdeClientWindow(HWND, HWND); 158 LPARAM PackDDElParam(UINT, UINT_PTR, UINT_PTR); 159 BOOL UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR); 160 BOOL FreeDDElParam(UINT, LPARAM); 161 LPARAM ReuseDDElParam(LPARAM, UINT, UINT, UINT_PTR, UINT_PTR); 162 } 163 164 debug (WindowsUnitTest) { 165 unittest { 166 DDEACK ddeack; 167 168 with (ddeack) { 169 reserved = 10; 170 assert (_bf == 0x0A); 171 fBusy = true; 172 assert (_bf == 0x4A); 173 fAck = true; 174 assert (_bf == 0xCA); 175 176 assert (reserved == 10); 177 assert (fBusy == true); 178 assert (fAck == true); 179 180 reserved = 43; 181 assert (_bf == 0xEB); 182 fBusy = false; 183 assert (_bf == 0xAB); 184 fAck = false; 185 assert (_bf == 0x2B); 186 187 assert (reserved == 43); 188 assert (fBusy == false); 189 assert (fAck == false); 190 } 191 192 DDEPOKE ddepoke; 193 194 with (ddepoke) { 195 unused = 3456; 196 assert (_bf == 0x0D80); 197 fRelease = true; 198 assert (_bf == 0x2D80); 199 fReserved = 2; 200 assert (_bf == 0xAD80); 201 202 assert (unused == 3456); 203 assert (fRelease == true); 204 assert (fReserved == 2); 205 206 unused = 2109; 207 assert (_bf == 0xa83d); 208 fRelease = false; 209 assert (_bf == 0x883d); 210 fReserved = 1; 211 assert (_bf == 0x483d); 212 213 assert (unused == 2109); 214 assert (fRelease == false); 215 assert (fReserved == 1); 216 } 217 } 218 }