1 /***********************************************************************\
2 *                                olectl.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module win32.olectl;
11 version(Windows):
12 
13 // In conversion from MinGW, the following was deleted:
14 //#define FONTSIZE(n) {n##0000, 0}
15 
16 import win32.ocidl, win32.olectlid;
17 private import win32.basetyps, win32.oaidl, win32.oleauto, win32.unknwn,
18   win32.windef, win32.wingdi, win32.winuser, win32.wtypes;
19 private import win32.ntdef;     // for NTSTATUS
20 private import win32.objfwd;    // for LPSTREAM
21 private import win32.winerror;  // for SCODE
22 
23 
24 private {
25 	// These replace C macros.
26 	template ITF_ERROR_SCODE_FOR_D(int c)
27 	{
28 		const SCODE ITF_ERROR_SCODE_FOR_D
29 		  = (SEVERITY_ERROR << 31) | (FACILITY_ITF << 16) | c;
30 	}
31 
32 	template ITF_SUCCESS_SCODE_FOR_D(int c)
33 	{
34 		const SCODE ITF_SUCCESS_SCODE_FOR_D
35 		  = (SEVERITY_SUCCESS << 31) | (FACILITY_ITF << 16) | c;
36 	}
37 
38 	template STD_CTL_SCODE(int c)
39 	{
40 		const SCODE STD_CTL_SCODE
41 		  = (SEVERITY_ERROR << 31) | (FACILITY_CONTROL << 16) | c;
42 	}
43 }
44 
45 enum : SCODE {
46 	CTL_E_ILLEGALFUNCTIONCALL       = STD_CTL_SCODE!(5),
47 	CTL_E_OVERFLOW                  = STD_CTL_SCODE!(6),
48 	CTL_E_OUTOFMEMORY               = STD_CTL_SCODE!(7),
49 	CTL_E_DIVISIONBYZERO            = STD_CTL_SCODE!(11),
50 	CTL_E_OUTOFSTRINGSPACE          = STD_CTL_SCODE!(14),
51 	CTL_E_OUTOFSTACKSPACE           = STD_CTL_SCODE!(28),
52 	CTL_E_BADFILENAMEORNUMBER       = STD_CTL_SCODE!(52),
53 	CTL_E_FILENOTFOUND              = STD_CTL_SCODE!(53),
54 	CTL_E_BADFILEMODE               = STD_CTL_SCODE!(54),
55 	CTL_E_FILEALREADYOPEN           = STD_CTL_SCODE!(55),
56 	CTL_E_DEVICEIOERROR             = STD_CTL_SCODE!(57),
57 	CTL_E_FILEALREADYEXISTS         = STD_CTL_SCODE!(58),
58 	CTL_E_BADRECORDLENGTH           = STD_CTL_SCODE!(59),
59 	CTL_E_DISKFULL                  = STD_CTL_SCODE!(61),
60 	CTL_E_BADRECORDNUMBER           = STD_CTL_SCODE!(63),
61 	CTL_E_BADFILENAME               = STD_CTL_SCODE!(64),
62 	CTL_E_TOOMANYFILES              = STD_CTL_SCODE!(67),
63 	CTL_E_DEVICEUNAVAILABLE         = STD_CTL_SCODE!(68),
64 	CTL_E_PERMISSIONDENIED          = STD_CTL_SCODE!(70),
65 	CTL_E_DISKNOTREADY              = STD_CTL_SCODE!(71),
66 	CTL_E_PATHFILEACCESSERROR       = STD_CTL_SCODE!(75),
67 	CTL_E_PATHNOTFOUND              = STD_CTL_SCODE!(76),
68 	CTL_E_INVALIDPATTERNSTRING      = STD_CTL_SCODE!(93),
69 	CTL_E_INVALIDUSEOFNULL          = STD_CTL_SCODE!(94),
70 	CTL_E_INVALIDFILEFORMAT         = STD_CTL_SCODE!(321),
71 	CTL_E_INVALIDPROPERTYVALUE      = STD_CTL_SCODE!(380),
72 	CTL_E_INVALIDPROPERTYARRAYINDEX = STD_CTL_SCODE!(381),
73 	CTL_E_SETNOTSUPPORTEDATRUNTIME  = STD_CTL_SCODE!(382),
74 	CTL_E_SETNOTSUPPORTED           = STD_CTL_SCODE!(383),
75 	CTL_E_NEEDPROPERTYARRAYINDEX    = STD_CTL_SCODE!(385),
76 	CTL_E_SETNOTPERMITTED           = STD_CTL_SCODE!(387),
77 	CTL_E_GETNOTSUPPORTEDATRUNTIME  = STD_CTL_SCODE!(393),
78 	CTL_E_GETNOTSUPPORTED           = STD_CTL_SCODE!(394),
79 	CTL_E_PROPERTYNOTFOUND          = STD_CTL_SCODE!(422),
80 	CTL_E_INVALIDCLIPBOARDFORMAT    = STD_CTL_SCODE!(460),
81 	CTL_E_INVALIDPICTURE            = STD_CTL_SCODE!(481),
82 	CTL_E_PRINTERERROR              = STD_CTL_SCODE!(482),
83 	CTL_E_CANTSAVEFILETOTEMP        = STD_CTL_SCODE!(735),
84 	CTL_E_SEARCHTEXTNOTFOUND        = STD_CTL_SCODE!(744),
85 	CTL_E_REPLACEMENTSTOOLONG       = STD_CTL_SCODE!(746),
86 	CTL_E_CUSTOM_FIRST              = STD_CTL_SCODE!(600)
87 }
88 
89 const SCODE CLASS_E_NOTLICENSED = CLASSFACTORY_E_FIRST+2;
90 
91 enum : SCODE {
92 	CONNECT_E_FIRST           = ITF_ERROR_SCODE_FOR_D!(0x200),
93 	CONNECT_E_LAST            = ITF_ERROR_SCODE_FOR_D!(0x20F),
94 	CONNECT_S_FIRST           = ITF_SUCCESS_SCODE_FOR_D!(0x200),
95 	CONNECT_S_LAST            = ITF_SUCCESS_SCODE_FOR_D!(0x20F),
96 	CONNECT_E_NOCONNECTION    = CONNECT_E_FIRST + 0,
97 	CONNECT_E_ADVISELIMIT     = CONNECT_E_FIRST + 1,
98 	CONNECT_E_CANNOTCONNECT   = CONNECT_E_FIRST + 2,
99 	CONNECT_E_OVERRIDDEN      = CONNECT_E_FIRST + 3,
100 
101 	SELFREG_E_FIRST           = ITF_ERROR_SCODE_FOR_D!(0x200),
102 	SELFREG_E_LAST            = ITF_ERROR_SCODE_FOR_D!(0x20F),
103 	SELFREG_S_FIRST           = ITF_SUCCESS_SCODE_FOR_D!(0x200),
104 	SELFREG_S_LAST            = ITF_SUCCESS_SCODE_FOR_D!(0x20F),
105 	SELFREG_E_TYPELIB         = SELFREG_E_FIRST + 0,
106 	SELFREG_E_CLASS           = SELFREG_E_FIRST + 1,
107 
108 	PERPROP_E_FIRST           = ITF_ERROR_SCODE_FOR_D!(0x200),
109 	PERPROP_E_LAST            = ITF_ERROR_SCODE_FOR_D!(0x20F),
110 	PERPROP_S_FIRST           = ITF_SUCCESS_SCODE_FOR_D!(0x200),
111 	PERPROP_S_LAST            = ITF_SUCCESS_SCODE_FOR_D!(0x20F),
112 	PERPROP_E_NOPAGEAVAILABLE = PERPROP_E_FIRST
113 }
114 
115 enum {
116 	OLEMISC_RECOMPOSEONRESIZE            = 0x1,
117 	OLEMISC_ONLYICONIC                   = 0x2,
118 	OLEMISC_INSERTNOTREPLACE             = 0x4,
119 	OLEMISC_STATIC                       = 0x8,
120 	OLEMISC_CANTLINKINSIDE               = 0x10,
121 	OLEMISC_CANLINKBYOLE1                = 0x20,
122 	OLEMISC_ISLINKOBJECT                 = 0x40,
123 	OLEMISC_INSIDEOUT                    = 0x80,
124 	OLEMISC_ACTIVATEWHENVISIBLE          = 0x100,
125 	OLEMISC_RENDERINGISDEVICEINDEPENDENT = 0x200,
126 	OLEMISC_INVISIBLEATRUNTIME           = 0x400,
127 	OLEMISC_ALWAYSRUN                    = 0x800,
128 	OLEMISC_ACTSLIKEBUTTON               = 0x1000,
129 	OLEMISC_ACTSLIKELABEL                = 0x2000,
130 	OLEMISC_NOUIACTIVATE                 = 0x4000,
131 	OLEMISC_ALIGNABLE                    = 0x8000,
132 	OLEMISC_SIMPLEFRAME                  = 0x10000,
133 	OLEMISC_SETCLIENTSITEFIRST           = 0x20000,
134 	OLEMISC_IMEMODE                      = 0x40000,
135 	OLEMISC_IGNOREACTIVATEWHENVISIBLE    = 0x80000,
136 	OLEMISC_WANTSTOMENUMERGE             = 0x100000,
137 	OLEMISC_SUPPORTSMULTILEVELUNDO       = 0x200000
138 }
139 const OLEIVERB_PROPERTIES = -7;
140 
141 const VT_STREAMED_PROPSET = 73;
142 const VT_STORED_PROPSET = 74;
143 const VT_BLOB_PROPSET = 75;
144 const VT_VERBOSE_ENUM = 76;
145 const VT_COLOR = VARENUM.VT_I4;
146 const VT_XPOS_PIXELS = VARENUM.VT_I4;
147 const VT_YPOS_PIXELS = VARENUM.VT_I4;
148 const VT_XSIZE_PIXELS = VARENUM.VT_I4;
149 const VT_YSIZE_PIXELS = VARENUM.VT_I4;
150 const VT_XPOS_HIMETRIC = VARENUM.VT_I4;
151 const VT_YPOS_HIMETRIC = VARENUM.VT_I4;
152 const VT_XSIZE_HIMETRIC = VARENUM.VT_I4;
153 const VT_YSIZE_HIMETRIC = VARENUM.VT_I4;
154 const VT_TRISTATE = VARENUM.VT_I2;
155 const VT_OPTEXCLUSIVE = VARENUM.VT_BOOL;
156 const VT_FONT = VARENUM.VT_DISPATCH;
157 const VT_PICTURE = VARENUM.VT_DISPATCH;
158 const VT_HANDLE = VARENUM.VT_I4;
159 
160 enum {
161 	OCM__BASE = WM_USER + 0x1c00,
162 	OCM_COMMAND = OCM__BASE + WM_COMMAND,
163 	OCM_CTLCOLORBTN = OCM__BASE + WM_CTLCOLORBTN,
164 	OCM_CTLCOLOREDIT = OCM__BASE + WM_CTLCOLOREDIT,
165 	OCM_CTLCOLORDLG = OCM__BASE + WM_CTLCOLORDLG,
166 	OCM_CTLCOLORLISTBOX = OCM__BASE + WM_CTLCOLORLISTBOX,
167 	OCM_CTLCOLORMSGBOX = OCM__BASE + WM_CTLCOLORMSGBOX,
168 	OCM_CTLCOLORSCROLLBAR = OCM__BASE + WM_CTLCOLORSCROLLBAR,
169 	OCM_CTLCOLORSTATIC = OCM__BASE + WM_CTLCOLORSTATIC,
170 	OCM_DRAWITEM = OCM__BASE + WM_DRAWITEM,
171 	OCM_MEASUREITEM = OCM__BASE + WM_MEASUREITEM,
172 	OCM_DELETEITEM = OCM__BASE + WM_DELETEITEM,
173 	OCM_VKEYTOITEM = OCM__BASE + WM_VKEYTOITEM,
174 	OCM_CHARTOITEM = OCM__BASE + WM_CHARTOITEM,
175 	OCM_COMPAREITEM = OCM__BASE + WM_COMPAREITEM,
176 	OCM_HSCROLL = OCM__BASE + WM_HSCROLL,
177 	OCM_VSCROLL = OCM__BASE + WM_VSCROLL,
178 	OCM_PARENTNOTIFY = OCM__BASE + WM_PARENTNOTIFY,
179 	OCM_NOTIFY = OCM__BASE + WM_NOTIFY
180 }
181 
182 enum {
183 	CTRLINFO_EATS_RETURN = 1,
184 	CTRLINFO_EATS_ESCAPE
185 }
186 
187 enum {
188 	XFORMCOORDS_POSITION            = 1,
189 	XFORMCOORDS_SIZE                = 2,
190 	XFORMCOORDS_HIMETRICTOCONTAINER = 4,
191 	XFORMCOORDS_CONTAINERTOHIMETRIC = 8
192 }
193 
194 const GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1;
195 
196 enum {
197 	PROPPAGESTATUS_DIRTY = 1,
198 	PROPPAGESTATUS_VALIDATE = 2
199 }
200 
201 enum {
202 	PICTURE_SCALABLE = 1,
203 	PICTURE_TRANSPARENT = 2
204 }
205 
206 enum {
207 	PICTYPE_UNINITIALIZED  =  -1,
208 	PICTYPE_NONE,       // = 0
209 	PICTYPE_BITMAP,
210 	PICTYPE_METAFILE,
211 	PICTYPE_ICON,
212 	PICTYPE_ENHMETAFILE // = 4
213 }
214 
215 enum {
216 	DISPID_AUTOSIZE = -500,
217 	DISPID_BACKCOLOR = -501,
218 	DISPID_BACKSTYLE = -502,
219 	DISPID_BORDERCOLOR = -503,
220 	DISPID_BORDERSTYLE = -504,
221 	DISPID_BORDERWIDTH = -505,
222 	DISPID_DRAWMODE = -507,
223 	DISPID_DRAWSTYLE = -508,
224 	DISPID_DRAWWIDTH = -509,
225 	DISPID_FILLCOLOR = -510,
226 	DISPID_FILLSTYLE = -511,
227 	DISPID_FONT = -512,
228 	DISPID_FORECOLOR = -513,
229 	DISPID_ENABLED = -514,
230 	DISPID_HWND = -515,
231 	DISPID_TABSTOP = -516,
232 	DISPID_TEXT = -517,
233 	DISPID_CAPTION = -518,
234 	DISPID_BORDERVISIBLE = -519,
235 	DISPID_APPEARANCE = -520,
236 	DISPID_MOUSEPOINTER = -521,
237 	DISPID_MOUSEICON = -522,
238 	DISPID_PICTURE = -523,
239 	DISPID_VALID = -524,
240 	DISPID_REFRESH = -550,
241 	DISPID_DOCLICK = -551,
242 	DISPID_ABOUTBOX = -552,
243 	DISPID_CLICK = -600,
244 	DISPID_DBLCLICK = -601,
245 	DISPID_KEYDOWN = -602,
246 	DISPID_KEYPRESS = -603,
247 	DISPID_KEYUP = -604,
248 	DISPID_MOUSEDOWN = -605,
249 	DISPID_MOUSEMOVE = -606,
250 	DISPID_MOUSEUP = -607,
251 	DISPID_ERROREVENT = -608,
252 	DISPID_AMBIENT_BACKCOLOR = -701,
253 	DISPID_AMBIENT_DISPLAYNAME = -702,
254 	DISPID_AMBIENT_FONT = -703,
255 	DISPID_AMBIENT_FORECOLOR = -704,
256 	DISPID_AMBIENT_LOCALEID = -705,
257 	DISPID_AMBIENT_MESSAGEREFLECT = -706,
258 	DISPID_AMBIENT_SCALEUNITS = -707,
259 	DISPID_AMBIENT_TEXTALIGN = -708,
260 	DISPID_AMBIENT_USERMODE = -709,
261 	DISPID_AMBIENT_UIDEAD = -710,
262 	DISPID_AMBIENT_SHOWGRABHANDLES = -711,
263 	DISPID_AMBIENT_SHOWHATCHING = -712,
264 	DISPID_AMBIENT_DISPLAYASDEFAULT = -713,
265 	DISPID_AMBIENT_SUPPORTSMNEMONICS = -714,
266 	DISPID_AMBIENT_AUTOCLIP = -715,
267 	DISPID_AMBIENT_APPEARANCE = -716,
268 	DISPID_AMBIENT_CODEPAGE = -725,
269 	DISPID_AMBIENT_PALETTE = -726,
270 	DISPID_AMBIENT_CHARSET = -727,
271 	DISPID_AMBIENT_RIGHTTOLEFT = -732,
272 	DISPID_AMBIENT_TOPTOBOTTOM = -733
273 }
274 
275 enum {
276 	DISPID_FONT_NAME = 0,
277 	DISPID_FONT_SIZE = 2,
278 	DISPID_FONT_BOLD,
279 	DISPID_FONT_ITALIC,
280 	DISPID_FONT_UNDER,
281 	DISPID_FONT_STRIKE,
282 	DISPID_FONT_WEIGHT,
283 	DISPID_FONT_CHARSET // = 8
284 }
285 
286 enum {
287 	DISPID_PICT_HANDLE = 0,
288 	DISPID_PICT_HPAL   = 2,
289 	DISPID_PICT_TYPE,
290 	DISPID_PICT_WIDTH,
291 	DISPID_PICT_HEIGHT,
292 	DISPID_PICT_RENDER // = 6
293 }
294 
295 alias IOleControl LPOLECONTROL;
296 alias IOleControlSite LPOLECONTROLSITE;
297 alias ISimpleFrameSite LPSIMPLEFRAMESITE;
298 alias IPersistPropertyBag LPPERSISTPROPERTYBAG;
299 alias IPersistStreamInit LPPERSISTSTREAMINIT;
300 alias IPersistMemory LPPERSISTMEMORY;
301 alias IPropertyNotifySink LPPROPERTYNOTIFYSINK;
302 alias IProvideClassInfo LPPROVIDECLASSINFO;
303 alias IProvideClassInfo2 LPPROVIDECLASSINFO2;
304 alias IConnectionPointContainer LPCONNECTIONPOINTCONTAINER;
305 alias IClassFactory2 LPCLASSFACTORY2;
306 alias ISpecifyPropertyPages LPSPECIFYPROPERTYPAGES;
307 alias IPerPropertyBrowsing LPPERPROPERTYBROWSING;
308 alias IPropertyPage LPPROPERTYPAGE;
309 alias IPropertyPage2 LPPROPERTYPAGE2;
310 
311 alias IPicture LPPICTURE;
312 alias IPictureDisp LPPICTUREDISP;
313 alias int OLE_XPOS_PIXELS;
314 alias int OLE_YPOS_PIXELS;
315 alias int OLE_XSIZE_PIXELS;
316 alias int OLE_YSIZE_PIXELS;
317 alias float OLE_XPOS_CONTAINER;
318 alias float OLE_YPOS_CONTAINER;
319 alias float OLE_XSIZE_CONTAINER;
320 
321 alias VARIANT_BOOL OLE_OPTEXCLUSIVE;
322 alias VARIANT_BOOL OLE_CANCELBOOL;
323 alias VARIANT_BOOL OLE_ENABLEDEFAULTBOOL;
324 
325 align(8):
326 
327 enum OLE_TRISTATE {
328 	triUnchecked,
329 	triChecked1,
330 	triGray
331 }
332 
333 struct OCPFIPARAMS {
334 	ULONG cbStructSize;
335 	HWND hWndOwner;
336 	int x;
337 	int y;
338 	LPCOLESTR lpszCaption;
339 	ULONG cObjects;
340 	LPUNKNOWN *lplpUnk;
341 	ULONG cPages;
342 	CLSID *lpPages;
343 	LCID lcid;
344 	DISPID dispidInitialProperty;
345 }
346 alias OCPFIPARAMS* LPOCPFIPARAMS;
347 
348 struct FONTDESC {
349 	UINT cbSizeofstruct;
350 	LPOLESTR lpstrName;
351 	CY cySize;
352 	SHORT sWeight;
353 	SHORT sCharset;
354 	BOOL fItalic;
355 	BOOL fUnderline;
356 	BOOL fStrikethrough;
357 }
358 alias FONTDESC* LPFONTDESC;
359 
360 struct PICTDESC
361 {
362 	UINT cbSizeofstruct;
363 	UINT picType;
364 	union {
365 		struct bmp {
366 			HBITMAP hbitmap;
367 			HPALETTE hpal;
368 		}
369 		struct wmf {
370 			HMETAFILE hmeta;
371 			int xExt;
372 			int yExt;
373 		}
374 		struct icon {
375 			HICON hicon;
376 		}
377 		struct emf {
378 			HENHMETAFILE hemf;
379 		}
380 	}
381 }
382 alias PICTDESC* LPPICTDESC;
383 
384 extern(Windows) {
385 	HRESULT DllRegisterServer();
386 	HRESULT DllUnregisterServer();
387 	HRESULT OleCreateFontIndirect(LPFONTDESC, REFIID, PVOID*);
388 	HRESULT OleCreatePictureIndirect(LPPICTDESC, REFIID, BOOL, PVOID*);
389 	HRESULT OleCreatePropertyFrame(HWND, UINT, UINT, LPCOLESTR, ULONG, LPUNKNOWN*, ULONG, LPCLSID, LCID, DWORD, PVOID);
390 	HRESULT OleCreatePropertyFrameIndirect(LPOCPFIPARAMS);
391 	HCURSOR OleIconToCursor(HINSTANCE, HICON);
392 	HRESULT OleLoadPicture(LPSTREAM, LONG, BOOL, REFIID, PVOID*);
393 	HRESULT OleLoadPictureEx(LPSTREAM, LONG, BOOL, REFIID, DWORD, DWORD, DWORD, LPVOID*);
394 	HRESULT OleLoadPicturePath(LPOLESTR, LPUNKNOWN, DWORD, OLE_COLOR, REFIID, LPVOID*);
395 	HRESULT OleLoadPictureFile(VARIANT, LPDISPATCH*);
396 	HRESULT OleLoadPictureFileEx(VARIANT, DWORD, DWORD, DWORD, LPDISPATCH*);
397 	HRESULT OleSavePictureFile(LPDISPATCH, BSTR);
398 	HRESULT OleTranslateColor(OLE_COLOR, HPALETTE, COLORREF*);
399 }