pub struct Target {
pub hwnd: isize,
pub pid: u32,
pub exe: String,
pub class: String,
pub integrity: Integrity,
}Expand description
The window that will receive injected text, captured as a snapshot.
Capture this at hotkey press, not at injection time: between press and release the user may have moved focus, and injecting into whatever happens to be foreground later is how text ends up in the wrong application.
Fields§
§hwnd: isizeRaw HWND of the captured foreground window.
pid: u32Process that owns the window.
exe: StringLowercased executable file name, e.g. code.exe. Empty when it could not be read.
class: StringReal window class of the foreground window, e.g. Chrome_RenderWidgetHostHWND.
integrity: IntegrityIntegrity level of the owning process. Determines whether SendInput can reach it.
Implementations§
Source§impl Target
impl Target
Sourcepub fn foreground() -> Result<Self, Error>
pub fn foreground() -> Result<Self, Error>
Snapshot the current foreground window.
Sourcepub fn still_foreground(&self) -> bool
pub fn still_foreground(&self) -> bool
True when this target still holds the foreground. Injection must be aborted otherwise.
Sourcepub fn accepts_injection(&self) -> bool
pub fn accepts_injection(&self) -> bool
Whether synthesized input can reach this target.
UIPI permits injection only into processes at an equal or lower integrity level.