pub struct IDropTarget(/* private fields */);Available on crate feature
ole only.Expand description
IDropTarget
COM interface.
Automatically calls
Release
when the object goes out of scope.
§Examples
Retrieving dropped files:
use winsafe::{self as w, prelude::*, co};
let drop_target = w::IDropTarget::new_impl();
drop_target.Drop(
|d: &w::IDataObject, key_st: co::MK, pt: w::POINT, fx: &mut co::DROPEFFECT|
-> w::AnyResult<()>
{
let mut fmt = w::FORMATETC::default();
fmt.cfFormat = co::CF::HDROP;
fmt.dwAspect = co::DVASPECT::CONTENT;
fmt.tymed = co::TYMED::HGLOBAL;
let medium = unsafe { d.GetData(&fmt)? };
let hglobal = unsafe { medium.ptr_hglobal().unwrap() };
let ptr_lock = hglobal.GlobalLock()?;
let hdrop = unsafe { w::HDROP::from_ptr(ptr_lock.as_ptr() as _) };
let dropped_paths = hdrop.DragQueryFile()?
.collect::<w::SysResult<Vec<_>>>()?;
for f in dropped_paths {
println!("> {f}");
}
Ok(())
},
);Implementations§
Source§impl IDropTarget
impl IDropTarget
Source§impl IDropTarget
impl IDropTarget
Sourcepub fn DragEnter<F>(&self, func: F) -> &Self
pub fn DragEnter<F>(&self, func: F) -> &Self
IDropTarget::DragEnter
method.
§Examples
use winsafe::{self as w, prelude::*, co};
let drop_target = w::IDropTarget::new_impl();
drop_target.DragEnter(
|d: &w::IDataObject, key_st: co::MK, pt: w::POINT, fx: &mut co::DROPEFFECT|
-> w::AnyResult<()>
{
*fx &= co::DROPEFFECT::COPY;
Ok(())
},
);Sourcepub fn DragLeave<F>(&self, func: F) -> &Self
pub fn DragLeave<F>(&self, func: F) -> &Self
IDropTarget::DragLeave
method.
Sourcepub fn DragOver<F>(&self, func: F) -> &Self
pub fn DragOver<F>(&self, func: F) -> &Self
IDropTarget::DragOver
method.
§Examples
use winsafe::{self as w, prelude::*, co};
let drop_target = w::IDropTarget::new_impl();
drop_target.DragOver(
|key_st: co::MK, pt: w::POINT, fx: &mut co::DROPEFFECT|
-> w::AnyResult<()>
{
*fx &= co::DROPEFFECT::COPY;
Ok(())
},
);Sourcepub fn Drop<F>(&self, func: F) -> &Self
pub fn Drop<F>(&self, func: F) -> &Self
IDropTarget::Drop
method.
Trait Implementations§
Source§impl Clone for IDropTarget
impl Clone for IDropTarget
Source§impl Drop for IDropTarget
impl Drop for IDropTarget
impl Send for IDropTarget
Source§impl ole_IUnknown for IDropTarget
impl ole_IUnknown for IDropTarget
Source§unsafe fn from_ptr(_p: *mut c_void) -> Self
unsafe fn from_ptr(_p: *mut c_void) -> Self
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
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
Returns the pointer to the underlying COM virtual table. Read more
Source§fn QueryInterface<T>(&self) -> HrResult<T>where
T: ole_IUnknown,
fn QueryInterface<T>(&self) -> HrResult<T>where
T: ole_IUnknown,
IUnknown::QueryInterface
method.Auto Trait Implementations§
impl !RefUnwindSafe for IDropTarget
impl !Sync for IDropTarget
impl !UnwindSafe for IDropTarget
impl Freeze for IDropTarget
impl Unpin for IDropTarget
impl UnsafeUnpin for IDropTarget
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