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