pub struct IFileOpenDialog(/* private fields */);
Available on crate feature
shell
only.Expand description
IFileOpenDialog
COM interface.
Automatically calls
Release
when the object goes out of scope.
§Examples
Choosing a single existing TXT file:
use winsafe::{self as w, prelude::*, co};
let hparent: w::HWND; // initialized somewhere
let file_open = w::CoCreateInstance::<w::IFileOpenDialog>(
&co::CLSID::FileOpenDialog,
None,
co::CLSCTX::INPROC_SERVER,
)?;
file_open.SetOptions(
file_open.GetOptions()?
| co::FOS::FORCEFILESYSTEM
| co::FOS::FILEMUSTEXIST,
)?;
file_open.SetFileTypes(&[
("Text files", "*.txt"),
("All files", "*.*"),
])?;
file_open.SetFileTypeIndex(1)?;
if file_open.Show(&hparent)? {
let chosen_file = file_open.GetResult()?
.GetDisplayName(co::SIGDN::FILESYSPATH)?;
println!("{}", chosen_file);
}
Trait Implementations§
Source§impl Clone for IFileOpenDialog
impl Clone for IFileOpenDialog
Source§impl Drop for IFileOpenDialog
impl Drop for IFileOpenDialog
Source§impl ole_IUnknown for IFileOpenDialog
impl ole_IUnknown for IFileOpenDialog
Source§unsafe fn from_ptr(p: *mut c_void) -> Self
unsafe fn from_ptr(p: *mut c_void) -> Self
Available on crate feature
ole
only.Creates an object from a COM virtual table pointer. Read more
Source§unsafe fn as_mut(&mut self) -> &mut *mut c_void
unsafe fn as_mut(&mut self) -> &mut *mut c_void
Available on crate feature
ole
only.Returns a mutable reference do the underlying COM virtual table pointer. Read more
Source§fn ptr(&self) -> *mut c_void
fn ptr(&self) -> *mut c_void
Available on crate feature
ole
only.Returns the pointer to the underlying COM virtual table. Read more
Source§unsafe fn null() -> Self
unsafe fn null() -> Self
Available on crate feature
ole
only.Creates an object from a null COM virtual table pointer. Read more
Source§fn QueryInterface<T>(&self) -> HrResult<T>where
T: ole_IUnknown,
fn QueryInterface<T>(&self) -> HrResult<T>where
T: ole_IUnknown,
Available on crate feature
ole
only.IUnknown::QueryInterface
method.Source§impl shell_IFileDialog for IFileOpenDialog
impl shell_IFileDialog for IFileOpenDialog
Source§fn AddPlace(&self, si: &impl shell_IShellItem, fdap: FDAP) -> HrResult<()>
fn AddPlace(&self, si: &impl shell_IShellItem, fdap: FDAP) -> HrResult<()>
IFileDialog::AddPlace
method.Source§fn Advise(&self, fde: &IFileDialogEvents) -> HrResult<u32>
fn Advise(&self, fde: &IFileDialogEvents) -> HrResult<u32>
IFileDialog::Advise
method.Source§fn ClearClientData(&self) -> HrResult<()>
fn ClearClientData(&self) -> HrResult<()>
IFileDialog::ClearClientData
method.Source§fn GetCurrentSelection(&self) -> HrResult<IShellItem>
fn GetCurrentSelection(&self) -> HrResult<IShellItem>
IFileDialog::GetCurrentSelection
method.Source§fn GetFileName(&self) -> HrResult<String>
fn GetFileName(&self) -> HrResult<String>
IFileDialog::GetFileName
method.Source§fn GetFileTypeIndex(&self) -> HrResult<u32>
fn GetFileTypeIndex(&self) -> HrResult<u32>
IFileDialog::GetFileTypeIndex
method.Source§fn GetFolder(&self) -> HrResult<IShellItem>
fn GetFolder(&self) -> HrResult<IShellItem>
IFileDialog::GetFolder
method.Source§fn GetOptions(&self) -> HrResult<FOS>
fn GetOptions(&self) -> HrResult<FOS>
IFileDialog::GetOptions
method.Source§fn GetResult(&self) -> HrResult<IShellItem>
fn GetResult(&self) -> HrResult<IShellItem>
IFileDialog::GetResult
method. Read moreSource§fn SetClientGuid(&self, guid: &GUID) -> HrResult<()>
fn SetClientGuid(&self, guid: &GUID) -> HrResult<()>
IFileDialog::SetClientGuid
method.Source§fn SetDefaultExtension(&self, default_extension: &str) -> HrResult<()>
fn SetDefaultExtension(&self, default_extension: &str) -> HrResult<()>
IFileDialog::SetDefaultExtension
method.Source§fn SetDefaultFolder(&self, si: &impl shell_IShellItem) -> HrResult<()>
fn SetDefaultFolder(&self, si: &impl shell_IShellItem) -> HrResult<()>
IFileDialog::SetDefaultFolder
method.Source§fn SetFileName(&self, name: &str) -> HrResult<()>
fn SetFileName(&self, name: &str) -> HrResult<()>
IFileDialog::SetFileName
method.Source§fn SetFileNameLabel(&self, label: &str) -> HrResult<()>
fn SetFileNameLabel(&self, label: &str) -> HrResult<()>
IFileDialog::SetFileNameLabel
method.Source§fn SetFileTypes<S: AsRef<str>>(&self, filter_spec: &[(S, S)]) -> HrResult<()>
fn SetFileTypes<S: AsRef<str>>(&self, filter_spec: &[(S, S)]) -> HrResult<()>
IFileDialog::SetFileTypes
method. Read moreSource§fn SetFolder(&self, si: &impl shell_IShellItem) -> HrResult<()>
fn SetFolder(&self, si: &impl shell_IShellItem) -> HrResult<()>
IFileDialog::SetFolder
method.Source§fn SetOkButtonLabel(&self, text: &str) -> HrResult<()>
fn SetOkButtonLabel(&self, text: &str) -> HrResult<()>
IFileDialog::SetOkButtonLabel
method.Source§fn SetOptions(&self, opts: FOS) -> HrResult<()>
fn SetOptions(&self, opts: FOS) -> HrResult<()>
IFileDialog::SetOptions
method.Source§impl shell_IFileOpenDialog for IFileOpenDialog
impl shell_IFileOpenDialog for IFileOpenDialog
Source§fn GetResults(&self) -> HrResult<IShellItemArray>
fn GetResults(&self) -> HrResult<IShellItemArray>
IFileOpenDialog::GetResults
method. Read moreSource§fn GetSelectedItems(&self) -> HrResult<IShellItemArray>
fn GetSelectedItems(&self) -> HrResult<IShellItemArray>
Source§impl shell_IModalWindow for IFileOpenDialog
impl shell_IModalWindow for IFileOpenDialog
impl Send for IFileOpenDialog
Auto Trait Implementations§
impl Freeze for IFileOpenDialog
impl RefUnwindSafe for IFileOpenDialog
impl !Sync for IFileOpenDialog
impl Unpin for IFileOpenDialog
impl UnwindSafe for IFileOpenDialog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more