Trait winsafe::prelude::comctl_Hwnd
source · pub trait comctl_Hwnd: user_Hwnd {
// Provided methods
fn DefSubclassProc<M>(&self, msg: M) -> M::RetType
where M: MsgSend { ... }
fn InitializeFlatSB(&self) -> HrResult<()> { ... }
fn RemoveWindowSubclass(
&self,
subclass_func: SUBCLASSPROC,
subclass_id: usize
) -> SysResult<()> { ... }
unsafe fn SetWindowSubclass(
&self,
subclass_proc: SUBCLASSPROC,
subclass_id: usize,
ref_data: usize
) -> SysResult<()> { ... }
fn TaskDialog(
&self,
hinstance: Option<&HINSTANCE>,
window_title: Option<&str>,
main_instruction: Option<&str>,
content: Option<&str>,
common_buttons: TDCBF,
icon: IconRes
) -> HrResult<DLGID> { ... }
fn UninitializeFlatSB(&self) -> HrResult<()> { ... }
}
Available on crate features
kernel
and comctl
only.Expand description
This trait is enabled with the comctl
feature, and provides methods for
HWND
.
Prefer importing this trait through the prelude:
use winsafe::prelude::*;
Provided Methods§
sourcefn DefSubclassProc<M>(&self, msg: M) -> M::RetTypewhere
M: MsgSend,
fn DefSubclassProc<M>(&self, msg: M) -> M::RetTypewhere
M: MsgSend,
DefSubclassProc
function.
The return type is variable, being defined by the RetType
associated
type of the MsgSend
trait. That means each
message can define its own return type.
sourcefn InitializeFlatSB(&self) -> HrResult<()>
fn InitializeFlatSB(&self) -> HrResult<()>
InitializeFlatSB
function.
sourcefn RemoveWindowSubclass(
&self,
subclass_func: SUBCLASSPROC,
subclass_id: usize
) -> SysResult<()>
fn RemoveWindowSubclass( &self, subclass_func: SUBCLASSPROC, subclass_id: usize ) -> SysResult<()>
RemoveWindowSubclass
function.
sourceunsafe fn SetWindowSubclass(
&self,
subclass_proc: SUBCLASSPROC,
subclass_id: usize,
ref_data: usize
) -> SysResult<()>
unsafe fn SetWindowSubclass( &self, subclass_proc: SUBCLASSPROC, subclass_id: usize, ref_data: usize ) -> SysResult<()>
sourcefn TaskDialog(
&self,
hinstance: Option<&HINSTANCE>,
window_title: Option<&str>,
main_instruction: Option<&str>,
content: Option<&str>,
common_buttons: TDCBF,
icon: IconRes
) -> HrResult<DLGID>
fn TaskDialog( &self, hinstance: Option<&HINSTANCE>, window_title: Option<&str>, main_instruction: Option<&str>, content: Option<&str>, common_buttons: TDCBF, icon: IconRes ) -> HrResult<DLGID>
TaskDialog
function.
If you need more customization, see the
TaskDialogIndirect
function.
§Examples
An information message with just an OK button:
use winsafe::{self as w, prelude::*, co};
let hwnd: w::HWND; // initialized somewhere
hwnd.TaskDialog(
None,
Some("Operation successful"),
None,
Some("The operation completed successfully."),
co::TDCBF::OK,
w::IconRes::Info,
)?;
Prompt the user to click OK or Cancel upon a question:
use winsafe::{self as w, prelude::*, co};
let hwnd: w::HWND; // initialized somewhere
let answer = hwnd.TaskDialog(
None,
Some("My app name"),
Some("File modified"),
Some("The file has been modified.\nProceed closing the application?"),
co::TDCBF::OK | co::TDCBF::CANCEL,
w::IconRes::Warn,
)?;
if answer == co::DLGID::OK {
println!("User clicked OK.");
}
sourcefn UninitializeFlatSB(&self) -> HrResult<()>
fn UninitializeFlatSB(&self) -> HrResult<()>
UninitializeFlatSB
function.
Object Safety§
This trait is not object safe.