Trait winsafe::prelude::shell_Hdrop

source ·
pub trait shell_Hdrop: Handle {
    // Provided methods
    fn DragQueryFile(
        &mut self
    ) -> SysResult<impl Iterator<Item = SysResult<String>> + '_> { ... }
    fn DragQueryPoint(&self) -> (POINT, bool) { ... }
}
Available on crate features kernel and shell only.
Expand description

This trait is enabled with the shell feature, and provides methods for HDROP.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

fn DragQueryFile( &mut self ) -> SysResult<impl Iterator<Item = SysResult<String>> + '_>

DragQueryFile function.

Returns an iterator over the dropped files. After the iterator is consumed, calls DragFinish and invalidates the HDROP handle, so further calls will fail with ERROR::INVALID_HANDLE error code.

§Examples

Iterating over the strings:

use winsafe::{self as w, prelude::*};

let mut hdrop: w::HDROP; // initialized somewhere

for file_path in hdrop.DragQueryFile()? {
    let file_path = file_path?;
    println!("File: {}", file_path);
}

Collecting the strings into a Vec:

use winsafe::{self as w, prelude::*};

let mut hdrop: w::HDROP; // initialized somewhere

let file_paths = hdrop.DragQueryFile()?
    .collect::<w::SysResult<Vec<_>>>()?;
source

fn DragQueryPoint(&self) -> (POINT, bool)

DragQueryPoint function.

Returns the coordinates and whether the drop occurred in the client area of the window.

Note that you must call this method before DragQueryFile, because it invalidates the HDROP handle after the iterator is consumed.

Object Safety§

This trait is not object safe.

Implementors§