Struct winsafe::IFileOpenDialog
source · pub struct IFileOpenDialog(/* private fields */);
Available on crate feature
shell
only.Expand description
IFileOpenDialog
COM interface over IFileOpenDialogVT
.
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: &impl shell_IFileDialogEvents) -> HrResult<u32>
fn Advise(&self, fde: &impl shell_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 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