MCPcopy Create free account
hub / github.com/Recordscript/recordscript / exclude

Method exclude

libs/scrap/src/dxgi/mag.rs:436–480  ·  view source on GitHub ↗
(&mut self, cls: &str, name: &str)

Source from the content-addressed store, hash-verified

434 }
435
436 pub(crate) fn exclude(&mut self, cls: &str, name: &str) -> Result<bool> {
437 let name_c = CString::new(name)?;
438 unsafe {
439 let mut hwnd = if cls.len() == 0 {
440 FindWindowExA(NULL as _, NULL as _, NULL as _, name_c.as_ptr())
441 } else {
442 let cls_c = CString::new(cls).unwrap();
443 FindWindowExA(NULL as _, NULL as _, cls_c.as_ptr(), name_c.as_ptr())
444 };
445
446 if hwnd.is_null() {
447 return Ok(false);
448 }
449
450 if let Some(set_window_filter_list_func) =
451 self.mag_interface.set_window_filter_list_func
452 {
453 if FALSE
454 == set_window_filter_list_func(
455 self.magnifier_window,
456 MW_FILTERMODE_EXCLUDE,
457 1,
458 &mut hwnd,
459 )
460 {
461 return Err(Error::new(
462 ErrorKind::Other,
463 format!(
464 "Failed MagSetWindowFilterList for cls {} name {}, error {}",
465 cls,
466 name,
467 Error::last_os_error()
468 ),
469 ));
470 }
471 } else {
472 return Err(Error::new(
473 ErrorKind::Other,
474 "Unreachable, MagSetWindowFilterList should not be none",
475 ));
476 }
477 }
478
479 Ok(true)
480 }
481
482 pub(crate) fn get_rect(&self) -> ((i32, i32), usize, usize) {
483 (

Callers 2

testFunction · 0.45
recordFunction · 0.45

Calls 1

is_nullMethod · 0.45

Tested by 1

testFunction · 0.36