DefaultWindowsApi

Struct DefaultWindowsApi 

pub struct DefaultWindowsApi;
Expand description

Default implementation of WindowsApi that calls actual Windows APIs.

This implementation provides direct access to Windows system APIs and should be used in production code. For testing, use the MockWindowsApi instead.

Trait Implementations§

§

impl Clone for DefaultWindowsApi

§

fn clone(&self) -> DefaultWindowsApi

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl WindowsApi for DefaultWindowsApi

§

fn set_console_title(&self, title: &str) -> Result<()>

Sets the console window title. Read more
§

fn get_console_title(&self, buffer: &mut [u16]) -> i32

Gets the console window title as UTF-16 buffer. Read more
§

fn get_os_version(&self) -> String

Gets OS version string. Read more
§

fn arrange_console(&self, x: i32, y: i32, width: i32, height: i32) -> Result<()>

Arranges the console window position and size. Read more
§

fn set_console_text_attribute( &self, attributes: CONSOLE_CHARACTER_ATTRIBUTES, ) -> Result<()>

Sets console text attribute. Read more
§

fn get_console_screen_buffer_info(&self) -> Result<CONSOLE_SCREEN_BUFFER_INFO>

Gets console screen buffer info. Read more
§

fn fill_console_output_attribute( &self, attribute: u16, length: u32, coord: COORD, ) -> Result<u32>

Fills console output with specified attribute. Read more
§

fn scroll_console_screen_buffer( &self, scroll_rect: SMALL_RECT, scroll_target: COORD, fill_char: CHAR_INFO, ) -> Result<()>

Scrolls console screen buffer. Read more
§

fn set_console_cursor_position(&self, position: COORD) -> Result<()>

Sets console cursor position. Read more
§

fn get_std_handle(&self, handle_type: STD_HANDLE) -> Result<HANDLE>

Gets standard handle. Read more
§

fn read_console_input(&self, buffer: &mut [INPUT_RECORD]) -> Result<u32>

Reads console input. Read more
§

fn set_console_border_color(&self, color: &COLORREF) -> Result<()>

Sets DWM window attribute for border color. Read more
§

fn write_console_input( &self, buffer: &[INPUT_RECORD], number_written: &mut u32, ) -> Result<()>

Writes input records to the console input buffer. Read more
§

fn get_last_error(&self) -> u32

Gets the last Windows error code. Read more
§

fn generate_console_ctrl_event( &self, ctrl_event: u32, process_group_id: u32, ) -> Result<()>

Generates a console control event. Read more
§

fn get_stdout_handle(&self) -> Result<HANDLE>

Get standard output handle Read more
§

fn get_console_screen_buffer_info_with_handle( &self, handle: HANDLE, ) -> Result<CONSOLE_SCREEN_BUFFER_INFO>

Get console screen buffer information Read more
§

fn get_window_handle_for_process(&self, process_id: u32) -> HWND

Get window handle for process ID Read more
§

fn create_process_raw( &self, application: &str, command_line: PWSTR, startup_info: &mut STARTUPINFOW, process_info: &mut PROCESS_INFORMATION, ) -> Result<()>

Low-level process creation API call Read more
§

fn get_console_window(&self) -> HWND

Gets the console window handle. Read more
§

fn get_foreground_window(&self) -> HWND

Gets the foreground window handle. Read more
§

fn set_foreground_window(&self, hwnd: HWND) -> Result<()>

Sets the foreground window. Read more
§

fn get_console_mode(&self, handle: HANDLE) -> Result<CONSOLE_MODE>

Gets console mode for the specified handle. Read more
§

fn set_console_mode(&self, handle: HANDLE, mode: CONSOLE_MODE) -> Result<()>

Sets console mode for the specified handle. Read more
§

fn get_exit_code(&self, handle: HANDLE) -> Result<u32>

Gets the exit code of the specified process. Read more
§

fn move_window( &self, hwnd: HWND, x: i32, y: i32, width: i32, height: i32, repaint: bool, ) -> Result<()>

Moves and resizes a window. Read more
§

fn get_window_placement(&self, hwnd: HWND) -> Result<WINDOWPLACEMENT>

Gets window placement information. Read more
§

fn show_window(&self, hwnd: HWND, cmd_show: SHOW_WINDOW_CMD) -> Result<bool>

Shows a window in the specified state. Read more
§

fn focus_window_with_automation(&self, hwnd: HWND) -> Result<()>

Focuses a window using UI Automation. Read more
§

fn is_window(&self, hwnd: HWND) -> bool

Checks if a window handle is valid. Read more
§

fn open_process( &self, access: u32, inherit: bool, process_id: u32, ) -> Result<HANDLE>

Opens a process with the specified access rights. Read more
§

fn initialize_com_library(&self, coinit: COINIT) -> Result<()>

Initializes the COM library for use by the calling thread. Read more
§

fn get_system_metrics(&self, index: SYSTEM_METRICS_INDEX) -> i32

Gets system metrics information. Read more
§

fn set_process_dpi_awareness(&self, value: PROCESS_DPI_AWARENESS) -> Result<()>

Sets the process DPI awareness. Read more
§

fn create_process_with_args( &self, application: &str, args: Vec<String>, ) -> Option<PROCESS_INFORMATION>

Create a new process Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.