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
impl Clone for DefaultWindowsApi
§fn clone(&self) -> DefaultWindowsApi
fn clone(&self) -> DefaultWindowsApi
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl WindowsApi for DefaultWindowsApi
impl WindowsApi for DefaultWindowsApi
§fn set_console_title(&self, title: &str) -> Result<()>
fn set_console_title(&self, title: &str) -> Result<()>
Sets the console window title. Read more
§fn get_console_title(&self, buffer: &mut [u16]) -> i32
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
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<()>
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<()>
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>
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>
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<()>
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<()>
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>
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>
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<()>
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<()>
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
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<()>
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>
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>
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
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<()>
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
fn get_console_window(&self) -> HWND
Gets the console window handle. Read more
§fn get_foreground_window(&self) -> HWND
fn get_foreground_window(&self) -> HWND
Gets the foreground window handle. Read more
§fn set_foreground_window(&self, hwnd: HWND) -> Result<()>
fn set_foreground_window(&self, hwnd: HWND) -> Result<()>
Sets the foreground window. Read more
§fn get_console_mode(&self, handle: HANDLE) -> Result<CONSOLE_MODE>
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<()>
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>
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<()>
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>
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>
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<()>
fn focus_window_with_automation(&self, hwnd: HWND) -> Result<()>
Focuses a window using UI Automation. Read more
§fn open_process(
&self,
access: u32,
inherit: bool,
process_id: u32,
) -> Result<HANDLE>
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<()>
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
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<()>
fn set_process_dpi_awareness(&self, value: PROCESS_DPI_AWARENESS) -> Result<()>
Sets the process DPI awareness. Read more
Auto Trait Implementations§
impl Freeze for DefaultWindowsApi
impl RefUnwindSafe for DefaultWindowsApi
impl Send for DefaultWindowsApi
impl Sync for DefaultWindowsApi
impl Unpin for DefaultWindowsApi
impl UnwindSafe for DefaultWindowsApi
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