如果我得到一个 CGWindowID (_windowID) 如下......
NSArray *windowList = (__bridge NSArray *)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
for (NSDictionary *info in windowList) {
if ([[info objectForKey:(NSString *)kCGWindowOwnerName] isEqualToString:@"window name"] && ![[info objectForKey:(NSString *)kCGWindowName] isEqualToString:@""]) {
_windowID = [[info objectForKey:(NSString *)kCGWindowNumber] unsignedIntValue];
}
}
如何正确测试窗口 id 是否仍然有效且窗口尚未关闭?我是否只是运行类似的代码来检查窗口 ID 是否存在?
提前致谢