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