1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
pub type SFGAOF = ::ULONG;
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum SIGDN {
NORMALDISPLAY = 0,
PARENTRELATIVEPARSING = 0x80018001u32 as i32,
DESKTOPABSOLUTEPARSING = 0x80028000u32 as i32,
PARENTRELATIVEEDITING = 0x80031001u32 as i32,
DESKTOPABSOLUTEEDITING = 0x8004c000u32 as i32,
FILESYSPATH = 0x80058000u32 as i32,
URL = 0x80068000u32 as i32,
PARENTRELATIVEFORADDRESSBAR = 0x8007c001u32 as i32,
PARENTRELATIVE = 0x80080001u32 as i32,
PARENTRELATIVEFORUI = 0x80094001u32 as i32,
}
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum SICHINTF {
DISPLAY = 0,
ALLFIELDS = 0x80000000u32 as i32,
CANONICAL = 0x10000000,
TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000,
}
RIDL!(
interface IShellItem(IShellItemVtbl): IUnknown(IUnknownVtbl) {
fn BindToHandler(
&mut self, pbc: *mut ::IBindCtx, bhid: ::REFGUID, riid: ::REFIID, ppv: *mut *mut ::c_void
) -> ::HRESULT,
fn GetParent(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT,
fn GetDisplayName(&mut self, sigdnName: SIGDN, ppszName: *mut ::LPWSTR) -> ::HRESULT,
fn GetAttributes(&mut self, sfgaoMask: SFGAOF, psfgaoAttribs: *mut SFGAOF) -> ::HRESULT,
fn Compare(&mut self, psi: *mut IShellItem, hint: SICHINTF, piOrder: *mut ::c_int) -> ::HRESULT
}
);
pub type IFileOperationProgressSink = ::IUnknown;
pub type IShellItemArray = ::IUnknown;
RIDL!(
interface IModalWindow(IModalWindowVtbl): IUnknown(IUnknownVtbl) {
fn Show(&mut self, hwndOwner: ::HWND) -> ::HRESULT
}
);
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum FDE_OVERWRITE_RESPONSE {
DEFAULT = 0,
ACCEPT = 1,
REFUSE = 2,
}
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum FDE_SHAREVIOLATION_RESPONSE {
DEFAULT = 0,
ACCEPT = 1,
REFUSE = 2,
}
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum FDAP {
BOTTOM = 0,
TOP = 1,
}
RIDL!(
interface IFileDialogEvents(IFileDialogEventsVtbl): IUnknown(IUnknownVtbl) {
fn OnFileOk(&mut self, pfd: *mut IFileDialog) -> ::HRESULT,
fn OnFolderChanging(&mut self, pfd: *mut IFileDialog, psiFolder: *mut IShellItem) -> ::HRESULT,
fn OnFolderChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT,
fn OnSelectionChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT,
fn OnShareViolation(
&mut self, pfd: *mut IFileDialog, psi: *mut IShellItem,
pResponse: *mut FDE_SHAREVIOLATION_RESPONSE
) -> ::HRESULT,
fn OnTypeChange(&mut self, pfd: *mut IFileDialog) -> ::HRESULT,
fn OnOverwrite(
&mut self, pfd: *mut IFileDialog, psi: *mut IShellItem,
pResponse: *mut FDE_OVERWRITE_RESPONSE
) -> ::HRESULT
}
);
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum FILEOPENDIALOGOPTIONS {
OVERWRITEPROMPT = 0x2,
STRICTFILETYPES = 0x4,
NOCHANGEDIR = 0x8,
PICKFOLDERS = 0x20,
FORCEFILESYSTEM = 0x40,
ALLNONSTORAGEITEMS = 0x80,
NOVALIDATE = 0x100,
ALLOWMULTISELECT = 0x200,
PATHMUSTEXIST = 0x800,
FILEMUSTEXIST = 0x1000,
CREATEPROMPT = 0x2000,
SHAREAWARE = 0x4000,
NOREADONLYRETURN = 0x8000,
NOTESTFILECREATE = 0x10000,
HIDEMRUPLACES = 0x20000,
HIDEPINNEDPLACES = 0x40000,
NODEREFERENCELINKS = 0x100000,
DONTADDTORECENT = 0x2000000,
FORCESHOWHIDDEN = 0x10000000,
DEFAULTNOMINIMODE = 0x20000000,
FORCEPREVIEWPANEON = 0x40000000,
SUPPORTSTREAMABLEITEMS = 0x80000000u32 as i32,
}
RIDL!(
interface IFileDialog(IFileDialogVtbl): IModalWindow(IModalWindowVtbl) {
fn SetFileTypes(
&mut self, cFileTypes: ::UINT, rgFilterSpec: *const ::COMDLG_FILTERSPEC
) -> ::HRESULT,
fn SetFileTypeIndex(&mut self, iFileType: ::UINT) -> ::HRESULT,
fn GetFileTypeIndex(&mut self, piFileType: *mut ::UINT) -> ::HRESULT,
fn Advise(&mut self, pfde: *mut IFileDialogEvents, pdwCookie: *mut ::DWORD) -> ::HRESULT,
fn Unadvise(&mut self, dwCookie: ::DWORD) -> ::HRESULT,
fn SetOptions(&mut self, fos: FILEOPENDIALOGOPTIONS) -> ::HRESULT,
fn GetOptions(&mut self, pfos: *mut FILEOPENDIALOGOPTIONS) -> ::HRESULT,
fn SetDefaultFolder(&mut self, psi: *mut IShellItem) -> ::HRESULT,
fn SetFolder(&mut self, psi: *mut IShellItem) -> ::HRESULT,
fn GetFolder(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT,
fn GetCurrentSelection(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT,
fn SetFileName(&mut self, pszName: ::LPCWSTR) -> ::HRESULT,
fn GetFileName(&mut self, pszName: *mut ::LPWSTR) -> ::HRESULT,
fn SetTitle(&mut self, pszTitle: ::LPCWSTR) -> ::HRESULT,
fn SetOkButtonLabel(&mut self, pszText: ::LPCWSTR) -> ::HRESULT,
fn SetFileNameLabel(&mut self, pszLabel: ::LPCWSTR) -> ::HRESULT,
fn GetResult(&mut self, ppsi: *mut *mut IShellItem) -> ::HRESULT,
fn AddPlace(&mut self, psi: *mut IShellItem, fdap: FDAP) -> ::HRESULT,
fn SetDefaultExtension(&mut self, pszDefaultExtension: ::LPCWSTR) -> ::HRESULT,
fn Close(&mut self, hr: ::HRESULT) -> ::HRESULT,
fn SetClientGuid(&mut self, guid: ::REFGUID) -> ::HRESULT,
fn ClearClientData(&mut self) -> ::HRESULT,
fn SetFilter(&mut self, pFilter: *mut IShellItemFilter) -> ::HRESULT
}
);
RIDL!(
interface IFileSaveDialog(IFileSaveDialogVtbl): IFileDialog(IFileDialogVtbl) {
fn SetSaveAsItem(&mut self, psi: *mut IShellItem) -> ::HRESULT,
fn SetProperties(&mut self, pStore: *mut ::IPropertyStore) -> ::HRESULT,
fn SetCollectedProperties(
&mut self, pList: *mut ::IPropertyDescriptionList, fAppendDefault: ::BOOL
) -> ::HRESULT,
fn GetProperties(&mut self, ppStore: *mut *mut ::IPropertyStore) -> ::HRESULT,
fn ApplyProperties(
&mut self, psi: *mut IShellItem, pStore: *mut ::IPropertyStore, hwnd: ::HWND,
pSink: *mut IFileOperationProgressSink
) -> ::HRESULT
}
);
RIDL!(
interface IFileOpenDialog(IFileOpenDialogVtbl): IFileDialog(IFileDialogVtbl) {
fn GetResults(&mut self, ppenum: *mut *mut IShellItemArray) -> ::HRESULT,
fn GetSelectedItems(&mut self, ppsai: *mut *mut IShellItemArray) -> ::HRESULT
}
);
#[repr(i32)] #[derive(Clone, Copy, Debug)]
pub enum CDCONTROLSTATEF {
INACTIVE = 0x00000000,
ENABLED = 0x00000001,
VISIBLE = 0x00000002,
ENABLEDVISIBLE = 0x00000003,
}
RIDL!(
interface IFileDialogCustomize(IFileDialogCustomizeVtbl): IUnknown(IUnknownVtbl) {
fn EnableOpenDropDown(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT,
fn AddMenu(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT,
fn AddPushButton(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT,
fn AddComboBox(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT,
fn AddRadioButtonList(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT,
fn AddCheckButton(
&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR, bChecked: ::BOOL
) -> ::HRESULT,
fn AddEditBox(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT,
fn AddSeparator(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT,
fn AddText(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT,
fn SetControlLabel(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT,
fn GetControlState(&mut self, dwIDCtl: ::DWORD, pdwState: *mut CDCONTROLSTATEF) -> ::HRESULT,
fn SetControlState(&mut self, dwIDCtl: ::DWORD, dwState: CDCONTROLSTATEF) -> ::HRESULT,
fn GetEditBoxText(&mut self, dwIDCtl: ::DWORD, ppszText: *mut *mut ::WCHAR) -> ::HRESULT,
fn SetEditBoxText(&mut self, dwIDCtl: ::DWORD, pszText: ::LPCWSTR) -> ::HRESULT,
fn GetCheckButtonState(&mut self, dwIDCtl: ::DWORD, pbChecked: *mut ::BOOL) -> ::HRESULT,
fn SetCheckButtonState(&mut self, dwIDCtl: ::DWORD, bChecked: ::BOOL) -> ::HRESULT,
fn AddControlItem(
&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pszLabel: ::LPCWSTR
) -> ::HRESULT,
fn RemoveControlItem(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD) -> ::HRESULT,
fn RemoveAllControlItems(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT,
fn GetControlItemState(
&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pdwState: *mut CDCONTROLSTATEF
) -> ::HRESULT,
fn SetControlItemState(
&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, dwState: CDCONTROLSTATEF
) -> ::HRESULT,
fn GetSelectedControlItem(&mut self, dwIDCtl: ::DWORD, pdwIDItem: *mut ::DWORD) -> ::HRESULT,
fn SetSelectedControlItem(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD) -> ::HRESULT,
fn StartVisualGroup(&mut self, dwIDCtl: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT,
fn EndVisualGroup(&mut self) -> ::HRESULT,
fn MakeProminent(&mut self, dwIDCtl: ::DWORD) -> ::HRESULT,
fn SetControlItemText(&mut self, dwIDCtl: ::DWORD, dwIDItem: ::DWORD, pszLabel: ::LPCWSTR) -> ::HRESULT
}
);
RIDL!(
interface IFileDialogControlEvents(IFileDialogControlEventsVtbl): IUnknown(IUnknownVtbl) {
fn OnItemSelected(
&mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD, dwIDItem: ::DWORD
) -> ::HRESULT,
fn OnButtonClicked(&mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD) -> ::HRESULT,
fn OnCheckButtonToggled(
&mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD, bChecked: ::BOOL
) -> ::HRESULT,
fn OnControlActivating(
&mut self, pfdc: *mut IFileDialogCustomize, dwIDCtl: ::DWORD
) -> ::HRESULT
}
);
RIDL!(
interface IFileDialog2(IFileDialog2Vtbl): IFileDialog(IFileDialogVtbl) {
fn SetCancelButtonLabel(&mut self, pszLabel: ::LPCWSTR) -> ::HRESULT,
fn SetNavigationRoot(&mut self, psi: IShellItem) -> ::HRESULT
}
);
pub type IShellItemFilter = ::IUnknown;