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/_ole.d) 9 */ 10 module core.sys.windows.ole; 11 version (Windows): 12 pragma(lib, "ole32"); 13 14 import core.sys.windows.windef, core.sys.windows.wingdi, core.sys.windows.uuid; 15 16 alias LPCSTR OLE_LPCSTR; 17 18 /+#define LRESULT LONG 19 #define HGLOBAL HANDLE+/ 20 21 enum { 22 OT_LINK = 1, 23 OT_EMBEDDED, 24 OT_STATIC 25 } 26 27 enum OLEVERB_PRIMARY = 0; 28 enum OF_SET = 1; 29 enum OF_GET = 2; 30 enum OF_HANDLER = 4; 31 32 struct OLETARGETDEVICE { 33 USHORT otdDeviceNameOffset; 34 USHORT otdDriverNameOffset; 35 USHORT otdPortNameOffset; 36 USHORT otdExtDevmodeOffset; 37 USHORT otdExtDevmodeSize; 38 USHORT otdEnvironmentOffset; 39 USHORT otdEnvironmentSize; 40 BYTE _otdData; 41 BYTE* otdData() return { return &_otdData; } 42 } 43 alias OLETARGETDEVICE* LPOLETARGETDEVICE; 44 45 enum OLESTATUS { 46 OLE_OK, 47 OLE_WAIT_FOR_RELEASE, 48 OLE_BUSY, 49 OLE_ERROR_PROTECT_ONLY, 50 OLE_ERROR_MEMORY, 51 OLE_ERROR_STREAM, 52 OLE_ERROR_STATIC, 53 OLE_ERROR_BLANK, 54 OLE_ERROR_DRAW, 55 OLE_ERROR_METAFILE, 56 OLE_ERROR_ABORT, 57 OLE_ERROR_CLIPBOARD, 58 OLE_ERROR_FORMAT, 59 OLE_ERROR_OBJECT, 60 OLE_ERROR_OPTION, 61 OLE_ERROR_PROTOCOL, 62 OLE_ERROR_ADDRESS, 63 OLE_ERROR_NOT_EQUAL, 64 OLE_ERROR_HANDLE, 65 OLE_ERROR_GENERIC, 66 OLE_ERROR_CLASS, 67 OLE_ERROR_SYNTAX, 68 OLE_ERROR_DATATYPE, 69 OLE_ERROR_PALETTE, 70 OLE_ERROR_NOT_LINK, 71 OLE_ERROR_NOT_EMPTY, 72 OLE_ERROR_SIZE, 73 OLE_ERROR_DRIVE, 74 OLE_ERROR_NETWORK, 75 OLE_ERROR_NAME, 76 OLE_ERROR_TEMPLATE, 77 OLE_ERROR_NEW, 78 OLE_ERROR_EDIT, 79 OLE_ERROR_OPEN, 80 OLE_ERROR_NOT_OPEN, 81 OLE_ERROR_LAUNCH, 82 OLE_ERROR_COMM, 83 OLE_ERROR_TERMINATE, 84 OLE_ERROR_COMMAND, 85 OLE_ERROR_SHOW, 86 OLE_ERROR_DOVERB, 87 OLE_ERROR_ADVISE_NATIVE, 88 OLE_ERROR_ADVISE_PICT, 89 OLE_ERROR_ADVISE_RENAME, 90 OLE_ERROR_POKE_NATIVE, 91 OLE_ERROR_REQUEST_NATIVE, 92 OLE_ERROR_REQUEST_PICT, 93 OLE_ERROR_SERVER_BLOCKED, 94 OLE_ERROR_REGISTRATION, 95 OLE_ERROR_ALREADY_REGISTERED, 96 OLE_ERROR_TASK, 97 OLE_ERROR_OUTOFDATE, 98 OLE_ERROR_CANT_UPDATE_CLIENT, 99 OLE_ERROR_UPDATE, 100 OLE_ERROR_SETDATA_FORMAT, 101 OLE_ERROR_STATIC_FROM_OTHER_OS, 102 OLE_ERROR_FILE_VER, 103 OLE_WARN_DELETE_DATA = 1000 104 } 105 106 enum OLE_NOTIFICATION { 107 OLE_CHANGED, 108 OLE_SAVED, 109 OLE_CLOSED, 110 OLE_RENAMED, 111 OLE_QUERY_PAINT, 112 OLE_RELEASE, 113 OLE_QUERY_RETRY 114 } 115 116 enum OLE_RELEASE_METHOD { 117 OLE_NONE, 118 OLE_DELETE, 119 OLE_LNKPASTE, 120 OLE_EMBPASTE, 121 OLE_SHOW, 122 OLE_RUN, 123 OLE_ACTIVATE, 124 OLE_UPDATE, 125 OLE_CLOSE, 126 OLE_RECONNECT, 127 OLE_SETUPDATEOPTIONS, 128 OLE_SERVERUNLAUNCH, 129 OLE_LOADFROMSTREAM, 130 OLE_SETDATA, 131 OLE_REQUESTDATA, 132 OLE_OTHER, 133 OLE_CREATE, 134 OLE_CREATEFROMTEMPLATE, 135 OLE_CREATELINKFROMFILE, 136 OLE_COPYFROMLNK, 137 OLE_CREATEFROMFILE, 138 OLE_CREATEINVISIBLE 139 } 140 141 enum OLEOPT_RENDER { 142 olerender_none, 143 olerender_draw, 144 olerender_format 145 } 146 147 alias WORD OLECLIPFORMAT; 148 149 enum OLEOPT_UPDATE { 150 oleupdate_always, 151 oleupdate_onsave, 152 oleupdate_oncall, 153 // #ifdef OLE_INTERNAL 154 oleupdate_onclose 155 // #endif 156 } 157 158 mixin DECLARE_HANDLE!("HOBJECT"); 159 alias LONG_PTR LHSERVER, LHCLIENTDOC, LHSERVERDOC; 160 161 struct OLEOBJECTVTBL { 162 extern (Windows) { 163 void* function(LPOLEOBJECT, OLE_LPCSTR) QueryProtocol; 164 OLESTATUS function(LPOLEOBJECT) Release; 165 OLESTATUS function(LPOLEOBJECT, BOOL) Show; 166 OLESTATUS function(LPOLEOBJECT, UINT, BOOL, BOOL) DoVerb; 167 OLESTATUS function(LPOLEOBJECT, OLECLIPFORMAT, HANDLE*) GetData; 168 OLESTATUS function(LPOLEOBJECT, OLECLIPFORMAT, HANDLE) SetData; 169 OLESTATUS function(LPOLEOBJECT, HGLOBAL) SetTargetDevice; 170 OLESTATUS function(LPOLEOBJECT, RECT*) SetBounds; 171 OLECLIPFORMAT function(LPOLEOBJECT, OLECLIPFORMAT) EnumFormats; 172 OLESTATUS function(LPOLEOBJECT, LOGPALETTE*) SetColorScheme; 173 //#ifndef SERVERONLY 174 OLESTATUS function(LPOLEOBJECT) Delete; 175 OLESTATUS function(LPOLEOBJECT, OLE_LPCSTR, OLE_LPCSTR) SetHostNames; 176 OLESTATUS function(LPOLEOBJECT, LPOLESTREAM) SaveToStream; 177 OLESTATUS function(LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR, 178 LPOLEOBJECT*) Clone; 179 OLESTATUS function(LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR, 180 LPOLEOBJECT*) CopyFromLink; 181 OLESTATUS function(LPOLEOBJECT, LPOLEOBJECT) Equal; 182 OLESTATUS function(LPOLEOBJECT) CopyToClipboard; 183 OLESTATUS function(LPOLEOBJECT, HDC, RECT*, RECT*, HDC) Draw; 184 OLESTATUS function(LPOLEOBJECT, UINT, BOOL, BOOL, HWND, RECT*) 185 Activate; 186 OLESTATUS function(LPOLEOBJECT, HGLOBAL, UINT) Execute; 187 OLESTATUS function(LPOLEOBJECT) Close; 188 OLESTATUS function(LPOLEOBJECT) Update; 189 OLESTATUS function(LPOLEOBJECT) Reconnect; 190 OLESTATUS function(LPOLEOBJECT, OLE_LPCSTR, LPOLECLIENT, LHCLIENTDOC, 191 OLE_LPCSTR, LPOLEOBJECT*) ObjectConvert; 192 OLESTATUS function(LPOLEOBJECT, OLEOPT_UPDATE*) GetLinkUpdateOptions; 193 OLESTATUS function(LPOLEOBJECT, OLEOPT_UPDATE) SetLinkUpdateOptions; 194 OLESTATUS function(LPOLEOBJECT, OLE_LPCSTR) Rename; 195 OLESTATUS function(LPOLEOBJECT, LPSTR, UINT*) QueryName; 196 OLESTATUS function(LPOLEOBJECT, LONG*) QueryType; 197 OLESTATUS function(LPOLEOBJECT, RECT*) QueryBounds; 198 OLESTATUS function(LPOLEOBJECT, DWORD*) QuerySize; 199 OLESTATUS function(LPOLEOBJECT) QueryOpen; 200 OLESTATUS function(LPOLEOBJECT) QueryOutOfDate; 201 OLESTATUS function(LPOLEOBJECT) QueryReleaseStatus; 202 OLESTATUS function(LPOLEOBJECT) QueryReleaseError; 203 OLE_RELEASE_METHOD function(LPOLEOBJECT) QueryReleaseMethod; 204 OLESTATUS function(LPOLEOBJECT, OLECLIPFORMAT) RequestData; 205 OLESTATUS function(LPOLEOBJECT, UINT, LONG*) ObjectLong; 206 OLESTATUS function(LPOLEOBJECT, HANDLE, LPOLECLIENT, BOOL) ChangeData; 207 //#endif 208 } 209 } 210 alias OLEOBJECTVTBL* LPOLEOBJECTVTBL; 211 212 //#ifndef OLE_INTERNAL 213 struct OLEOBJECT { 214 LPOLEOBJECTVTBL lpvtbl; 215 } 216 alias OLEOBJECT* LPOLEOBJECT; 217 //#endif 218 219 struct OLECLIENTVTBL { 220 extern (Windows) int function(LPOLECLIENT, OLE_NOTIFICATION, LPOLEOBJECT) CallBack; 221 } 222 alias OLECLIENTVTBL* LPOLECLIENTVTBL; 223 224 struct OLECLIENT { 225 LPOLECLIENTVTBL lpvtbl; 226 } 227 alias OLECLIENT* LPOLECLIENT; 228 229 struct OLESTREAMVTBL { 230 extern (Windows): 231 DWORD function(LPOLESTREAM, void*, DWORD) Get; 232 DWORD function(LPOLESTREAM, void*, DWORD) Put; 233 } 234 alias OLESTREAMVTBL* LPOLESTREAMVTBL; 235 236 struct OLESTREAM { 237 LPOLESTREAMVTBL lpstbl; 238 } 239 alias OLESTREAM* LPOLESTREAM; 240 241 enum OLE_SERVER_USE { 242 OLE_SERVER_MULTI, 243 OLE_SERVER_SINGLE 244 } 245 246 struct OLESERVERVTBL { 247 extern (Windows): 248 OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, LPOLESERVERDOC*) 249 Open; 250 OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, OLE_LPCSTR, 251 LPOLESERVERDOC*) Create; 252 OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, OLE_LPCSTR, 253 OLE_LPCSTR, LPOLESERVERDOC*) CreateFromTemplate; 254 OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, OLE_LPCSTR, 255 LPOLESERVERDOC*) Edit; 256 OLESTATUS function(LPOLESERVER) Exit; 257 OLESTATUS function(LPOLESERVER) Release; 258 OLESTATUS function(LPOLESERVER, HGLOBAL) Execute; 259 } 260 alias TypeDef!(OLESERVERVTBL*) LPOLESERVERVTBL; 261 262 struct OLESERVER { 263 LPOLESERVERVTBL lpvtbl; 264 } 265 alias OLESERVER* LPOLESERVER; 266 267 struct OLESERVERDOCVTBL { 268 extern (Windows): 269 OLESTATUS function(LPOLESERVERDOC) Save; 270 OLESTATUS function(LPOLESERVERDOC) Close; 271 OLESTATUS function(LPOLESERVERDOC, OLE_LPCSTR, OLE_LPCSTR) SetHostNames; 272 OLESTATUS function(LPOLESERVERDOC, RECT*) SetDocDimensions; 273 OLESTATUS function(LPOLESERVERDOC, OLE_LPCSTR, LPOLEOBJECT*, LPOLECLIENT) 274 GetObject; 275 OLESTATUS function(LPOLESERVERDOC) Release; 276 OLESTATUS function(LPOLESERVERDOC, LOGPALETTE*) SetColorScheme; 277 OLESTATUS function(LPOLESERVERDOC, HGLOBAL) Execute; 278 } 279 alias OLESERVERDOCVTBL* LPOLESERVERDOCVTBL; 280 281 struct OLESERVERDOC { 282 LPOLESERVERDOCVTBL lpvtbl; 283 } 284 alias OLESERVERDOC* LPOLESERVERDOC; 285 286 extern (Windows) { 287 OLESTATUS OleDelete(LPOLEOBJECT); 288 OLESTATUS OleRelease(LPOLEOBJECT); 289 OLESTATUS OleSaveToStream(LPOLEOBJECT, LPOLESTREAM); 290 OLESTATUS OleEqual(LPOLEOBJECT, LPOLEOBJECT); 291 OLESTATUS OleCopyToClipboard(LPOLEOBJECT); 292 OLESTATUS OleSetHostNames(LPOLEOBJECT, LPCSTR, LPCSTR); 293 OLESTATUS OleSetTargetDevice(LPOLEOBJECT, HGLOBAL); 294 OLESTATUS OleSetBounds(LPOLEOBJECT, LPCRECT); 295 OLESTATUS OleSetColorScheme(LPOLEOBJECT, const(LOGPALETTE)*); 296 OLESTATUS OleQueryBounds(LPOLEOBJECT, RECT*); 297 OLESTATUS OleQuerySize(LPOLEOBJECT, DWORD*); 298 OLESTATUS OleDraw(LPOLEOBJECT, HDC, LPCRECT, LPCRECT, HDC); 299 OLESTATUS OleQueryOpen(LPOLEOBJECT); 300 OLESTATUS OleActivate(LPOLEOBJECT, UINT, BOOL, BOOL, HWND, LPCRECT); 301 OLESTATUS OleExecute(LPOLEOBJECT, HGLOBAL, UINT); 302 OLESTATUS OleClose(LPOLEOBJECT); 303 OLESTATUS OleUpdate(LPOLEOBJECT); 304 OLESTATUS OleReconnect(LPOLEOBJECT); 305 OLESTATUS OleGetLinkUpdateOptions(LPOLEOBJECT, OLEOPT_UPDATE*); 306 OLESTATUS OleSetLinkUpdateOptions(LPOLEOBJECT, OLEOPT_UPDATE); 307 void* OleQueryProtocol(LPOLEOBJECT, LPCSTR); 308 OLESTATUS OleQueryReleaseStatus(LPOLEOBJECT); 309 OLESTATUS OleQueryReleaseError(LPOLEOBJECT); 310 OLE_RELEASE_METHOD OleQueryReleaseMethod(LPOLEOBJECT); 311 OLESTATUS OleQueryType(LPOLEOBJECT, LONG*); 312 DWORD OleQueryClientVersion(); 313 DWORD OleQueryServerVersion(); 314 OLECLIPFORMAT OleEnumFormats(LPOLEOBJECT, OLECLIPFORMAT); 315 OLESTATUS OleGetData(LPOLEOBJECT, OLECLIPFORMAT, HANDLE*); 316 OLESTATUS OleSetData(LPOLEOBJECT, OLECLIPFORMAT, HANDLE); 317 OLESTATUS OleQueryOutOfDate(LPOLEOBJECT); 318 OLESTATUS OleRequestData(LPOLEOBJECT, OLECLIPFORMAT); 319 OLESTATUS OleQueryLinkFromClip(LPCSTR, OLEOPT_RENDER, OLECLIPFORMAT); 320 OLESTATUS OleQueryCreateFromClip(LPCSTR, OLEOPT_RENDER, OLECLIPFORMAT); 321 OLESTATUS OleCreateFromClip(LPCSTR, LPOLECLIENT, LHCLIENTDOC, LPCSTR, 322 LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT); 323 OLESTATUS OleCreateLinkFromClip(LPCSTR, LPOLECLIENT, LHCLIENTDOC, LPCSTR, 324 LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT); 325 OLESTATUS OleCreateFromFile(LPCSTR, LPOLECLIENT, LPCSTR, LPCSTR, 326 LHCLIENTDOC, LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT); 327 OLESTATUS OleCreateLinkFromFile(LPCSTR, LPOLECLIENT, LPCSTR, LPCSTR, 328 LPCSTR, LHCLIENTDOC, LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT); 329 OLESTATUS OleLoadFromStream(LPOLESTREAM, LPCSTR, LPOLECLIENT, LHCLIENTDOC, 330 LPCSTR, LPOLEOBJECT*); 331 OLESTATUS OleCreate(LPCSTR, LPOLECLIENT, LPCSTR, LHCLIENTDOC, LPCSTR, 332 LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT); 333 OLESTATUS OleCreateInvisible(LPCSTR, LPOLECLIENT, LPCSTR, LHCLIENTDOC, 334 LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT, BOOL); 335 OLESTATUS OleCreateFromTemplate(LPCSTR, LPOLECLIENT, LPCSTR, LHCLIENTDOC, 336 LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT); 337 OLESTATUS OleClone(LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, LPCSTR, 338 LPOLEOBJECT*); 339 OLESTATUS OleCopyFromLink(LPOLEOBJECT, LPCSTR, LPOLECLIENT, LHCLIENTDOC, 340 LPCSTR, LPOLEOBJECT*); 341 OLESTATUS OleObjectConvert(LPOLEOBJECT, LPCSTR, LPOLECLIENT, LHCLIENTDOC, 342 LPCSTR, LPOLEOBJECT*); 343 OLESTATUS OleRename(LPOLEOBJECT, LPCSTR); 344 OLESTATUS OleQueryName(LPOLEOBJECT, LPSTR, UINT*); 345 OLESTATUS OleRevokeObject(LPOLECLIENT); 346 BOOL OleIsDcMeta(HDC); 347 OLESTATUS OleRegisterClientDoc(LPCSTR, LPCSTR, LONG, LHCLIENTDOC*); 348 OLESTATUS OleRevokeClientDoc(LHCLIENTDOC); 349 OLESTATUS OleRenameClientDoc(LHCLIENTDOC, LPCSTR); 350 OLESTATUS OleRevertClientDoc(LHCLIENTDOC); 351 OLESTATUS OleSavedClientDoc(LHCLIENTDOC); 352 OLESTATUS OleEnumObjects(LHCLIENTDOC, LPOLEOBJECT*); 353 OLESTATUS OleRegisterServer(LPCSTR, LPOLESERVER, LHSERVER*, HINSTANCE, 354 OLE_SERVER_USE); 355 OLESTATUS OleRevokeServer(LHSERVER); 356 OLESTATUS OleBlockServer(LHSERVER); 357 OLESTATUS OleUnblockServer(LHSERVER, BOOL*); 358 OLESTATUS OleLockServer(LPOLEOBJECT, LHSERVER*); 359 OLESTATUS OleUnlockServer(LHSERVER); 360 OLESTATUS OleRegisterServerDoc(LHSERVER, LPCSTR, LPOLESERVERDOC, 361 LHSERVERDOC*); 362 OLESTATUS OleRevokeServerDoc(LHSERVERDOC); 363 OLESTATUS OleRenameServerDoc(LHSERVERDOC, LPCSTR); 364 OLESTATUS OleRevertServerDoc(LHSERVERDOC); 365 OLESTATUS OleSavedServerDoc(LHSERVERDOC); 366 }