1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Process management module (refactored)
//!
//! Provides a three-layer architecture for process management:
//! - **Config Layer**: Immutable configurations defining how to find processes
//! - **Instance Layer**: Runtime state holding actual system resources
//! - **Manager Layer**: Centralized lifecycle management for multiple processes
//!
//! # Architecture Overview
//! ```text
//! ProcessManager (manages multiple processes)
//! └─> Process (single process instance)
//! ├─ Config (immutable settings)
//! └─ State (runtime resources: PID, handles, DC)
//! ```
//!
//! # Quick Start
//!
//! ## Simple Usage (Quick Initialization)
//! ```no_run
//! use win_auto_utils::process::Process;
//!
//! // Quick way: just specify the process name
//! let mut process = Process::by_name("notepad.exe");
//! process.init()?;
//! println!("PID: {:?}", process.pid());
//! ```
//!
//! ## Advanced Usage (With Builder)
//! ```no_run
//! use win_auto_utils::process::{Process, ProcessConfig, DCMode};
//!
//! // Use builder for fluent configuration
//! let config = ProcessConfig::builder("game.exe")
//! .dc_mode(DCMode::WindowClient)
//! .exclude_invisible()
//! .build();
//! let mut process = Process::new(config);
//! process.init()?;
//! ```
//!
//! ## Manager Usage (Multiple Processes)
//! ```no_run
//! use win_auto_utils::process::ProcessManager;
//!
//! let mut manager = ProcessManager::new();
//! manager.register_by_name("game", "lf2.exe")?;
//! manager.init("game")?;
//! ```
// Re-export main types for convenience
pub use ;
pub use ProcessManager;
pub use ;