### Get Desktop Window and Set Focus Source: https://github.com/rodrigocfd/winsafe/blob/master/src/lib.md Demonstrates calling native Win32 functions equivalent to `GetDesktopWindow` and `SetFocus` using WinSafe's static and instance methods for HWND. ```rust use winsafe::{prelude::*, HWND}; let hwnd = HWND::GetDesktopWindow(); hwnd.SetFocus(); ``` -------------------------------- ### Create and Configure ListView with Columns Source: https://context7.com/rodrigocfd/winsafe/llms.txt Demonstrates creating a ListView with multiple columns and setting up basic window properties. Use this to display tabular data with embedded custom data per item. ```rust use winsafe::{self as w, co, gui, prelude::*}; #[derive(Clone)] struct FileListWindow { wnd: gui::WindowMain, lst: gui::ListView, // stores String data with each item } impl FileListWindow { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "File List", size: gui::dpi(500, 400), ..Default::default() }); let lst = gui::ListView::new( &wnd, gui::ListViewOpts { position: gui::dpi(10, 10), size: gui::dpi(480, 350), columns: &[ ("Name", 200), ("Size", 100), ("Modified", 150), ], resize_behavior: (gui::Horz::Resize, gui::Vert::Resize), ..Default::default() }, ); let new_self = Self { wnd, lst }; new_self.setup_events(); new_self } fn setup_events(&self) { let lst = self.lst.clone(); self.wnd.on().wm_create(move |_| { // Add items with embedded path data lst.items().add( &["document.txt", "1.2 KB", "2024-01-15"], None, "C:\\docs\\document.txt".to_string(), )?; lst.items().add( &["photo.jpg", "2.5 MB", "2024-01-10"], None, "C:\\photos\\photo.jpg".to_string(), )?; Ok(0) }); let lst = self.lst.clone(); self.lst.on().lvn_item_changed(move |_| { let count = lst.items().selected_count(); println!("{} item(s) selected", count); Ok(()) }); let lst = self.lst.clone(); self.lst.on().lvn_item_activate(move |_| { if let Some(item) = lst.items().focused() { if let Some(path) = item.data() { println!("Opening: {}", path); } } Ok(()) }); } } ``` -------------------------------- ### Register Window Class Ex Source: https://github.com/rodrigocfd/winsafe/blob/master/src/lib.md Demonstrates registering a window class using `WNDCLASSEX` and `RegisterClassEx`, showing how `cbSize` is handled automatically and string fields like `lpszClassName` require a `WString` buffer. ```rust use winsafe::{RegisterClassEx, WNDCLASSEX, WString}; let mut wcx = WNDCLASSEX::default(); let mut buf = WString::from_str("MY_WINDOW"); wcx.set_lpszClassName(Some(&mut buf)); if let Err(err) = RegisterClassEx(&wcx) { // handle error... } ``` -------------------------------- ### Create and Show a Modal Settings Dialog Source: https://context7.com/rodrigocfd/winsafe/llms.txt Demonstrates creating a modal dialog with input fields and buttons. Event handlers are set up to close the dialog on button clicks. Use this for user input requiring immediate attention. ```rust use winsafe::{self as w, gui, prelude::*}; #[derive(Clone)] struct SettingsDialog { wnd: gui::WindowModal, txt_name: gui::Edit, btn_ok: gui::Button, btn_cancel: gui::Button, } impl SettingsDialog { fn new() -> Self { let wnd = gui::WindowModal::new(gui::WindowModalOpts { title: "Settings", size: gui::dpi(300, 150), ..Default::default() }); let txt_name = gui::Edit::new( &wnd, gui::EditOpts { position: gui::dpi(20, 20), width: gui::dpi_x(260), ..Default::default() }, ); let btn_ok = gui::Button::new( &wnd, gui::ButtonOpts { text: "OK", position: gui::dpi(100, 60), ..Default::default() }, ); let btn_cancel = gui::Button::new( &wnd, gui::ButtonOpts { text: "Cancel", position: gui::dpi(200, 60), ..Default::default() }, ); let new_self = Self { wnd, txt_name, btn_ok, btn_cancel }; new_self.setup_events(); new_self } fn setup_events(&self) { let wnd = self.wnd.clone(); self.btn_ok.on().bn_clicked(move || { wnd.close(); Ok(()) }); let wnd = self.wnd.clone(); self.btn_cancel.on().bn_clicked(move || { wnd.close(); Ok(()) }); } fn show(&self, parent: &impl gui::GuiParent) -> w::AnyResult<()> { self.wnd.show_modal(parent) } } ``` -------------------------------- ### Configure Resizable Window Layout in Rust Source: https://context7.com/rodrigocfd/winsafe/llms.txt Sets up a main window with a list view and two buttons, defining their resize behaviors. The list view resizes with the window, while buttons reposition horizontally. Requires `winsafe` crate. ```rust use winsafe::{self as w, gui, prelude::*}; #[derive(Clone)] struct ResizableWindow { wnd: gui::WindowMain, lst: gui::ListView<()>, btn_add: gui::Button, btn_remove: gui::Button, } impl ResizableWindow { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "Resizable Layout", size: gui::dpi(500, 400), ..Default::default() }); // List view resizes in both directions let lst = gui::ListView::new( &wnd, gui::ListViewOpts { position: gui::dpi(10, 10), size: gui::dpi(380, 350), resize_behavior: (gui::Horz::Resize, gui::Vert::Resize), ..Default::default() }, ); // Buttons move with right edge let btn_add = gui::Button::new( &wnd, gui::ButtonOpts { text: "Add", position: gui::dpi(400, 10), resize_behavior: (gui::Horz::Repos, gui::Vert::None), ..Default::default() }, ); let btn_remove = gui::Button::new( &wnd, gui::ButtonOpts { text: "Remove", position: gui::dpi(400, 45), resize_behavior: (gui::Horz::Repos, gui::Vert::None), ..Default::default() }, ); Self { wnd, lst, btn_add, btn_remove } } } // Horz::None - Fixed horizontal position // Horz::Repos - Moves with parent width change // Horz::Resize - Width grows with parent // Vert::None - Fixed vertical position // Vert::Repos - Moves with parent height change // Vert::Resize - Height grows with parent ``` -------------------------------- ### Create and Configure ProgressBar Source: https://context7.com/rodrigocfd/winsafe/llms.txt Shows how to initialize a ProgressBar control with a specified range and initial value. This is useful for visually indicating the progress of a task. ```rust use winsafe::{self as w, co, gui, prelude::*}; #[derive(Clone)] struct DownloadWindow { wnd: gui::WindowMain, progress: gui::ProgressBar, btn_start: gui::Button, } impl DownloadWindow { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "Download Progress", size: gui::dpi(400, 150), ..Default::default() }); let progress = gui::ProgressBar::new( &wnd, gui::ProgressBarOpts { position: gui::dpi(20, 20), size: gui::dpi(360, 25), range: (0, 100), value: 0, ..Default::default() }, ); let btn_start = gui::Button::new( &wnd, gui::ButtonOpts { text: "Start Download", position: gui::dpi(150, 60), ..Default::default() }, ); Self { wnd, progress, btn_start } } fn update_progress(&self, value: u32) { self.progress.set_position(value); // Change state based on progress if value == 100 { self.progress.set_state(co::PBST::NORMAL); } } } ``` -------------------------------- ### Rust String Operations with WString Source: https://context7.com/rodrigocfd/winsafe/llms.txt Demonstrates creating, manipulating, and converting Rust strings to Windows UTF-16 format using WString. Includes raw pointer access and file parsing with encoding detection. ```rust use winsafe::{self as w, prelude::*}; fn string_operations() -> w::SysResult<()> { // Create from Rust string let wstr = w::WString::from_str("Hello, Windows!"); // Get raw pointer for Win32 API calls let ptr: *const u16 = wstr.as_ptr(); println!("String length: {} chars", wstr.str_len()); // Parse file with encoding detection (UTF-8, UTF-16, ANSI) let file = w::FileMapped::open("C:\\data\\text.txt", w::FileAccess::ExistingReadOnly)?; let parsed = w::WString::parse(file.as_slice())?; let text: String = parsed.to_string(); // Case conversion let mut wstr = w::WString::from_str("Mixed Case Text"); wstr.make_lowercase(); println!("Lower: {}", wstr.to_string()); wstr.make_uppercase(); println!("Upper: {}", wstr.to_string()); // Allocate buffer for receiving strings from Win32 let mut buffer = w::WString::new_alloc_buf(256); // Pass buffer.as_mut_ptr() to Win32 functions... Ok(()) } ``` -------------------------------- ### Rust DPI Scaling Functions for UI Layout Source: https://context7.com/rodrigocfd/winsafe/llms.txt Demonstrates using `gui::dpi`, `gui::dpi_x`, and `gui::dpi_y` for DPI-aware scaling of UI elements in Rust applications. Requires `winsafe::gui`. ```rust use winsafe::gui; fn dpi_aware_layout() { // Scale both x and y coordinates let position = gui::dpi(20, 30); // Returns (scaled_x, scaled_y) // Scale horizontal value only let width = gui::dpi_x(200); // Scale vertical value only let height = gui::dpi_y(150); // Use in control creation let btn = gui::Button::new( &wnd, gui::ButtonOpts { position: gui::dpi(10, 10), width: gui::dpi_x(100), height: gui::dpi_y(30), ..Default::default() }, ); // At 100% DPI (96): dpi(20, 30) = (20, 30) // At 125% DPI (120): dpi(20, 30) = (25, 37) // At 150% DPI (144): dpi(20, 30) = (30, 45) } ``` -------------------------------- ### Create and Run Main Application Window in Rust Source: https://context7.com/rodrigocfd/winsafe/llms.txt Defines the main application window and its lifecycle. Handles uncaught errors by displaying a message box. The `run_main` method blocks until the window is closed. ```rust use winsafe::{self as w, co, gui, prelude::*}; fn main() { if let Err(err) = MyApp::create_and_run() { w::HWND::NULL .MessageBox(&err.to_string(), "Uncaught error", co::MB::ICONERROR) .unwrap(); } } #[derive(Clone)] struct MyApp { wnd: gui::WindowMain, } impl MyApp { fn create_and_run() -> w::AnyResult { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "My Application", size: gui::dpi(400, 300), ..Default::default() }); let new_self = Self { wnd }; new_self.events(); new_self.wnd.run_main(None) // blocks until window closes } fn events(&self) { let wnd = self.wnd.clone(); self.wnd.on().wm_create(move |_| { wnd.hwnd().SetWindowText("Window Created!")?; Ok(0) }); } } ``` -------------------------------- ### Rust Window Handle Operations with HWND Source: https://context7.com/rodrigocfd/winsafe/llms.txt Shows how to use the HWND struct to interact with Windows, including finding, manipulating, and enumerating windows. Requires `winsafe` crate. ```rust use winsafe::{self as w, co, prelude::*}; fn window_handle_operations() -> w::SysResult<()> { // Get desktop window let desktop = w::HWND::GetDesktopWindow(); // Find window by class and title if let Some(notepad) = w::HWND::FindWindow(Some("Notepad"), None) { // Bring to foreground notepad.SetForegroundWindow(); // Get window rectangle let rect = notepad.GetWindowRect()?; println!("Window position: ({}, {})", rect.left, rect.top); // Move and resize notepad.SetWindowPos( w::HwndPlace::None, w::POINT::with(100, 100), w::SIZE::with(800, 600), co::SWP::NOZORDER, )?; // Show message box (parented to notepad) notepad.MessageBox( "Hello from WinSafe!", "Message", co::MB::OK | co::MB::ICONINFORMATION, )?; } // Enumerate child windows let hwnd: w::HWND = w::HWND::GetDesktopWindow(); hwnd.EnumChildWindows(|child| -> bool { if let Ok(text) = child.GetWindowText() { if !text.is_empty() { println!("Child: {}", text); } } true // continue enumeration }); Ok(()) } ``` -------------------------------- ### Create and Configure CheckBox Control Source: https://context7.com/rodrigocfd/winsafe/llms.txt Shows how to create CheckBox controls for settings like dark mode and notifications, initializing them to checked or unchecked states. Includes an event handler for click events to report the checked state. ```rust use winsafe::{self as w, co, gui, prelude::*}; #[derive(Clone)] struct SettingsWindow { wnd: gui::WindowMain, chk_dark_mode: gui::CheckBox, chk_notifications: gui::CheckBox, } impl SettingsWindow { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "Settings", size: gui::dpi(300, 200), ..Default::default() }); let chk_dark_mode = gui::CheckBox::new( &wnd, gui::CheckBoxOpts { text: "Enable dark mode", position: gui::dpi(20, 20), check_state: co::BST::UNCHECKED, ..Default::default() }, ); let chk_notifications = gui::CheckBox::new( &wnd, gui::CheckBoxOpts { text: "Show notifications", position: gui::dpi(20, 50), check_state: co::BST::CHECKED, ..Default::default() }, ); let new_self = Self { wnd, chk_dark_mode, chk_notifications }; new_self.setup_events(); new_self } fn setup_events(&self) { let chk = self.chk_dark_mode.clone(); self.chk_dark_mode.on().bn_clicked(move || { let is_checked = chk.is_checked(); println!("Dark mode: {}", is_checked); Ok(()) }); } } ``` -------------------------------- ### Create a Push Button Control in Rust Source: https://context7.com/rodrigocfd/winsafe/llms.txt Sets up a main window with a push button. The button's text and position are configured using DPI-aware values. Handles the `bn_clicked` event to update the window's title. ```rust use winsafe::{self as w, co, gui, prelude::*}; #[derive(Clone)] struct MyWindow { wnd: gui::WindowMain, btn_hello: gui::Button, } impl MyWindow { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "Button Example", size: gui::dpi(300, 150), ..Default::default() }); let btn_hello = gui::Button::new( &wnd, gui::ButtonOpts { text: "&Click Me", position: gui::dpi(20, 20), width: gui::dpi_x(100), height: gui::dpi_y(30), ..Default::default() }, ); let new_self = Self { wnd, btn_hello }; new_self.setup_events(); new_self } fn setup_events(&self) { let wnd = self.wnd.clone(); self.btn_hello.on().bn_clicked(move || { wnd.hwnd().SetWindowText("Button was clicked!")?; Ok(()) }); } } ``` -------------------------------- ### Create and Configure Edit Control Source: https://context7.com/rodrigocfd/winsafe/llms.txt Demonstrates creating a single-line text input field with initial text and handling a button click to retrieve and display the entered text. Includes text selection functionality. ```rust use winsafe::{self as w, co, gui, prelude::*}; #[derive(Clone)] struct TextInputDemo { wnd: gui::WindowMain, txt_input: gui::Edit, btn_submit: gui::Button, } impl TextInputDemo { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "Edit Control Demo", size: gui::dpi(350, 150), ..Default::default() }); let txt_input = gui::Edit::new( &wnd, gui::EditOpts { position: gui::dpi(10, 10), width: gui::dpi_x(200), text: "Enter text here", ..Default::default() }, ); let btn_submit = gui::Button::new( &wnd, gui::ButtonOpts { text: "Get Text", position: gui::dpi(220, 10), ..Default::default() }, ); let new_self = Self { wnd, txt_input, btn_submit }; new_self.setup_events(); new_self } fn setup_events(&self) { let txt = self.txt_input.clone(); let wnd = self.wnd.clone(); self.btn_submit.on().bn_clicked(move || { let text = txt.text()?; wnd.hwnd().MessageBox(&text, "You entered", co::MB::OK)?; txt.set_selection(0, -1); // select all text Ok(()) }); } } ``` -------------------------------- ### Create and Run a Basic Window with a Button Source: https://github.com/rodrigocfd/winsafe/blob/master/README.md This Rust code defines a window with a button. It handles the button's click event by changing the window's title. Ensure the 'windows_subsystem' attribute is set for GUI applications. ```rust #![windows_subsystem = "windows"] use winsafe::{self as w, gui, prelude::*}; fn main() { if let Err(e) = MyWindow::create_and_run() { eprintln!("{}", e); } } #[derive(Clone)] pub struct MyWindow { wnd: gui::WindowMain, // responsible for managing the window btn_hello: gui::Button, // a button } impl MyWindow { pub fn create_and_run() -> w::AnyResult { let wnd = gui::WindowMain::new( // instantiate the window manager gui::WindowMainOpts { title: "My window title", size: gui::dpi(300, 150), ..Default::default() // leave all other options as default }, ); let btn_hello = gui::Button::new( &wnd, // the window manager is the parent of our button gui::ButtonOpts { text: "&Click me", position: gui::dpi(20, 20), ..Default::default() }, ); let new_self = Self { wnd, btn_hello }; new_self.events(); // attach our events new_self.wnd.run_main(None) // show the main window; will block until closed } fn events(&self) { let wnd = self.wnd.clone(); // clone so it can be passed into the closure self.btn_hello.on().bn_clicked(move || { wnd.hwnd().SetWindowText("Hello, world!")?; Ok(()) }); } } ``` -------------------------------- ### Create and Configure ComboBox Control Source: https://context7.com/rodrigocfd/winsafe/llms.txt Illustrates the creation of a ComboBox with predefined items and an initial selection. It includes an event handler for selection changes, updating the window title with the selected item's text. ```rust use winsafe::{self as w, gui, prelude::*}; #[derive(Clone)] struct SelectionDemo { wnd: gui::WindowMain, cmb_colors: gui::ComboBox, } impl SelectionDemo { fn new() -> Self { let wnd = gui::WindowMain::new(gui::WindowMainOpts { title: "ComboBox Demo", size: gui::dpi(300, 150), ..Default::default() }); let cmb_colors = gui::ComboBox::new( &wnd, gui::ComboBoxOpts { position: (20, 20), width: 150, items: &["Red", "Green", "Blue", "Yellow"], selected_item: Some(0), // select first item ..Default::default() }, ); let new_self = Self { wnd, cmb_colors }; new_self.setup_events(); new_self } fn setup_events(&self) { let cmb = self.cmb_colors.clone(); let wnd = self.wnd.clone(); self.cmb_colors.on().cbn_sel_change(move || { if let Some(idx) = cmb.items().selected_index() { let text = cmb.items().get(idx).text()?; wnd.hwnd().SetWindowText(&format!("Selected: {}", text))?; } Ok(()) }); } } ``` -------------------------------- ### Post Quit Message Source: https://github.com/rodrigocfd/winsafe/blob/master/src/lib.md Shows how to call the native `PostQuitMessage` free function using WinSafe. ```rust use winsafe::PostQuitMessage; PostQuitMessage(0); ``` -------------------------------- ### Add WinSafe Dependency to Cargo.toml Source: https://github.com/rodrigocfd/winsafe/blob/master/README.md To use WinSafe, add it as a dependency in your Cargo.toml file. Specify the desired version and any necessary features. ```toml [dependencies] winsafe = { version = "0.0.27", features = [] } ``` -------------------------------- ### Display Message Box with Constants Source: https://github.com/rodrigocfd/winsafe/blob/master/src/lib.md Illustrates calling the `MessageBox` function with native Win32 constants like `MB_OKCANCEL` and `MB_ICONINFORMATION` using WinSafe's typed constants. ```rust use winsafe::{prelude::*, co::MB, HWND}; let hwnd = HWND::GetDesktopWindow(); hwnd.MessageBox("Hello, world", "Title", MB::OKCANCEL | MB::ICONINFORMATION)?; # w::SysResult::Ok(()); ``` -------------------------------- ### Rust Type-Safe Win32 Constants with co Module Source: https://context7.com/rodrigocfd/winsafe/llms.txt Illustrates using the `co` module for type-safe Win32 constants in Rust, enabling bitflag operations and preventing type mismatches. Requires `winsafe` crate. ```rust use winsafe::{self as w, co, prelude::*}; fn constants_example() -> w::SysResult<()> { // Message box flags (can be combined with |) let flags = co::MB::OKCANCEL | co::MB::ICONQUESTION | co::MB::DEFBUTTON2; let result = w::HWND::NULL.MessageBox("Continue?", "Confirm", flags)?; match result { co::DLGID::OK => println!("User clicked OK"), co::DLGID::CANCEL => println!("User clicked Cancel"), _ => {} } // Window styles let style = co::WS::OVERLAPPEDWINDOW | co::WS::VISIBLE; let ex_style = co::WS_EX::APPWINDOW | co::WS_EX::WINDOWEDGE; // File access flags let access = co::GENERIC::READ | co::GENERIC::WRITE; // Error handling let error: co::ERROR = co::ERROR::FILE_NOT_FOUND; println!("Error code: {} - {}", error.raw(), error.to_string()); Ok(()) } ``` -------------------------------- ### Add WinSafe Dependency to Cargo.toml Source: https://github.com/rodrigocfd/winsafe/blob/master/README.md Include the WinSafe crate with the 'gui' feature enabled in your project's Cargo.toml file. ```toml [dependencies] winsafe = { version = "0.0.27", features = ["gui"] } ``` -------------------------------- ### Define a Custom Window Message Source: https://github.com/rodrigocfd/winsafe/blob/master/src/msg.md Create a custom message by defining a struct with its data and implementing the MsgSend and MsgSendRecv traits. Use co::WM::USER + offset for the message ID. The as_generic_wm method maps the custom struct to a WndMsg, and from_generic_wm reconstructs the struct from a WndMsg. ```rust use winsafe::{self as w, prelude::*, co, msg}; /// The integer value of our message ID. pub const MAKE_TOAST: co::WM = unsafe { co::WM::from_raw(co::WM::USER.raw() + 20) }; /// Our message with its parameter. struct MakeToast { how_many: u32, } impl MsgSend for MakeToast { type RetType = (); fn convert_ret(&self, _: isize) -> Self::RetType { () } fn as_generic_wm(&mut self) -> msg::WndMsg { msg::WndMsg { msg_id: MAKE_TOAST, wparam: self.how_many as _, lparam: 0, } } } impl MsgSendRecv for MakeToast { fn from_generic_wm(p: msg::WndMsg) -> Self { Self { how_many: p.wparam as _, } } } ``` -------------------------------- ### Synchronous File Read and Write Operations Source: https://context7.com/rodrigocfd/winsafe/llms.txt Performs synchronous file operations including reading the entire file content, writing to a file (creating it if it doesn't exist), retrieving file metadata, and appending data to an existing file. Use for straightforward file I/O. ```rust use winsafe::{self as w, prelude::*}; fn file_operations() -> w::SysResult<()> { // Read entire file let file = w::File::open("C:\\data\\input.txt", w::FileAccess::ExistingReadOnly)?; let raw_bytes = file.read_all()?; let text = w::WString::parse(&raw_bytes)?.to_string(); println!("File contents: {}", text); // Write to file (creates if doesn't exist) let file = w::File::open("C:\\data\\output.txt", w::FileAccess::OpenOrCreateRW)?; file.erase_and_write("Hello, World!\nSecond line.".as_bytes())?; // Get file metadata let (created, accessed, modified) = file.times()?; println!("Modified: {:04}-{:02}-{:02}", modified.wYear, modified.wMonth, modified.wDay); // Append to file let file = w::File::open("C:\\data\\log.txt", w::FileAccess::ExistingRW)?; let size = file.size()?; file.set_pointer_offset(size)?; file.write(b"\nNew log entry")?; Ok(()) } ``` -------------------------------- ### Memory-Mapped File Read and Write Operations Source: https://context7.com/rodrigocfd/winsafe/llms.txt Provides high-performance file reading and writing using memory mapping. Allows direct access to file contents as byte slices without explicit read/write calls. Suitable for large files or performance-critical applications. ```rust use winsafe::{self as w, prelude::*}; fn memory_mapped_read() -> w::SysResult<()> { // Fast file reading via memory mapping let file = w::FileMapped::open( "C:\\data\\large_file.txt", w::FileAccess::ExistingReadOnly, )?; // Access file contents as a byte slice let raw_bytes = file.as_slice(); // Parse with automatic encoding detection let text = w::WString::parse(raw_bytes)?.to_string(); println!("File size: {} bytes", file.size()); println!("First 100 chars: {}", &text[..100.min(text.len())]); // Read-write memory mapping let mut file = w::FileMapped::open( "C:\\data\\modify.bin", w::FileAccess::ExistingRW, )?; // Modify file contents directly in memory let data = file.as_mut_slice(); data[0] = 0x42; data[1] = 0x4D; Ok(()) } ``` -------------------------------- ### Winsafe Feature Dependency Chart Source: https://github.com/rodrigocfd/winsafe/blob/master/features-chart.md This Mermaid flowchart displays the dependency relationships between various features in the Winsafe project, as defined in Cargo.toml. It helps understand the structure and interconnections of the project's components. ```mermaid flowchart RL advapi --> kernel comctl --> ole dshow --> oleaut dwm --> uxtheme dxgi --> ole gdi --> user gui --> comctl gui --> uxtheme mf --> oleaut ole --> user oleaut --> ole psapi --> kernel shell --> oleaut taskschd --> oleaut user --> kernel uxtheme --> gdi uxtheme --> ole version --> kernel wininet --> kernel winspool --> user ``` -------------------------------- ### Send LVM_DELETEITEM Message Source: https://github.com/rodrigocfd/winsafe/blob/master/src/msg.md Use HWND::SendMessage to send an LVM_DELETEITEM message to delete an item from a ListView control. The index is 0-based. Ensure the ListView handle is initialized. ```rust use winsafe::{self as w, prelude::*, msg}; let hlistview: w::HWND; // initialized somewhere # let hlistview = w::HWND::NULL; hlistview.SendMessage( msg::lvm::DeleteItem { index: 2, }, ).expect("Failed to delete item 2."); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.