- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在文档中,它表示此方法返回的窗口列表:
CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
将按从前到后的顺序返回窗口。但它并没有...最前面的窗口应该是测试的,但这是这个数组的输出:
2011-03-12 18:18:14.221 test[982:a0f] (
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 22;
Width = 212;
X = 1662;
Y = 0;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 25;
kCGWindowMemoryUsage = 30104;
kCGWindowName = "";
kCGWindowNumber = 14;
kCGWindowOwnerName = SystemUIServer;
kCGWindowOwnerPID = 99;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
},
{
kCGWindowAlpha = 0;
kCGWindowBounds = {
Height = 22;
Width = 1920;
X = 0;
Y = 0;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 25;
kCGWindowMemoryUsage = 5528;
kCGWindowNumber = 15;
kCGWindowOwnerName = SystemUIServer;
kCGWindowOwnerPID = 99;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 22;
Width = 46;
X = 1874;
Y = 0;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 25;
kCGWindowMemoryUsage = 5528;
kCGWindowName = "";
kCGWindowNumber = 12;
kCGWindowOwnerName = SystemUIServer;
kCGWindowOwnerPID = 99;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 22;
Width = 1920;
X = 0;
Y = 0;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 24;
kCGWindowMemoryUsage = 218520;
kCGWindowName = "Shared Menubar";
kCGWindowNumber = 6;
kCGWindowOwnerName = "Window Server";
kCGWindowOwnerPID = 73;
kCGWindowSharingState = 2;
kCGWindowStoreType = 2;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 1058;
Width = 1920;
X = 0;
Y = 22;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 20;
kCGWindowMemoryUsage = 1200;
kCGWindowNumber = 13;
kCGWindowOwnerName = Dock;
kCGWindowOwnerPID = 98;
kCGWindowSharingState = 1;
kCGWindowStoreType = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 52;
Width = 676;
X = 622;
Y = 1028;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 19;
kCGWindowMemoryUsage = 157080;
kCGWindowName = "Magic Mirror";
kCGWindowNumber = 16;
kCGWindowOwnerName = Dock;
kCGWindowOwnerPID = 98;
kCGWindowSharingState = 2;
kCGWindowStoreType = 2;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 382;
Width = 480;
X = 335;
Y = 367;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 792496;
kCGWindowName = test;
kCGWindowNumber = 252;
kCGWindowOwnerName = test;
kCGWindowOwnerPID = 982;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 807;
Width = 1206;
X = 321;
Y = 157;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 4055280;
kCGWindowName = "AppDelegate.m - test";
kCGWindowNumber = 24;
kCGWindowOwnerName = Xcode;
kCGWindowOwnerPID = 132;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 967;
Width = 960;
X = 175;
Y = 22;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 3817968;
kCGWindowName = "test - Debugger Console";
kCGWindowNumber = 31;
kCGWindowOwnerName = Xcode;
kCGWindowOwnerPID = 132;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 967;
Width = 1845;
X = 121;
Y = 22;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 882288;
kCGWindowName = "CocoaDev Forums - get focused window id";
kCGWindowNumber = 80;
kCGWindowOwnerName = "Google Chrome";
kCGWindowOwnerPID = 244;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 784;
Width = 885;
X = 560;
Y = 157;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 318768;
kCGWindowName = "Console Messages";
kCGWindowNumber = 125;
kCGWindowOwnerName = Console;
kCGWindowOwnerPID = 482;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 494;
Width = 1167;
X = 519;
Y = 417;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 2441264;
kCGWindowName = Debug;
kCGWindowNumber = 54;
kCGWindowOwnerName = Finder;
kCGWindowOwnerPID = 100;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 382;
Width = 480;
X = 335;
Y = 367;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 55216;
kCGWindowName = test;
kCGWindowNumber = 223;
kCGWindowOwnerName = test;
kCGWindowOwnerPID = 849;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 437;
Width = 770;
X = 396;
Y = 308;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 238512;
kCGWindowName = Applications;
kCGWindowNumber = 19;
kCGWindowOwnerName = Finder;
kCGWindowOwnerPID = 100;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 437;
Width = 770;
X = 450;
Y = 429;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 0;
kCGWindowMemoryUsage = 332720;
kCGWindowName = Applications;
kCGWindowNumber = 17;
kCGWindowOwnerName = Finder;
kCGWindowOwnerPID = 100;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
kCGWindowWorkspace = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 14;
Width = 1920;
X = 0;
Y = 22;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = "-20";
kCGWindowMemoryUsage = 5528;
kCGWindowName = "Backstop Menubar";
kCGWindowNumber = 11;
kCGWindowOwnerName = "Window Server";
kCGWindowOwnerPID = 73;
kCGWindowSharingState = 1;
kCGWindowStoreType = 2;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 1080;
Width = 1920;
X = 0;
Y = 0;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = "-2147483627";
kCGWindowMemoryUsage = 1200;
kCGWindowName = "";
kCGWindowNumber = 10;
kCGWindowOwnerName = Finder;
kCGWindowOwnerPID = 100;
kCGWindowSharingState = 1;
kCGWindowStoreType = 1;
},
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 1080;
Width = 1920;
X = 0;
Y = 0;
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = "-2147483628";
kCGWindowMemoryUsage = 8328600;
kCGWindowName = Desktop;
kCGWindowNumber = 2;
kCGWindowOwnerName = "Window Server";
kCGWindowOwnerPID = 73;
kCGWindowSharingState = 2;
kCGWindowStoreType = 2;
}
)
什么是 SystemUIServer、dock 和 magic mirror?这些不是我最常用的应用程序。谢谢!
最佳答案
获取 Apple 示例应用程序的副本:Son Of Grab .然后构建并运行它,您将拥有一个非常方便的交互式应用程序,用于调查窗口服务器已知的所有窗口。
您的问题的答案是窗口是从前到后排列的,但是定义为窗口的用户界面元素比您预期的要多得多。这包括菜单栏、停靠栏、服务菜单、桌面等。这些在不同级别定义,对应于输出中的 kCGWindowLayer
。
您想要在标准窗口级别(零)定义第一个窗口。如果您查看输出,第一个带有 kCGWindowLayer == 0
的窗口实际上是第 7 个。
关于objective-c - 最前面的窗口使用 CGWindowListCopyWindowInfo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5286274/
https://github.com/mattdiamond/Recorderjs/blob/master/recorder.js中的代码 我不明白 JavaScript 语法,比如 (functio
在 iOS 7 及更早版本中,如果我们想在应用程序中找到 topMostWindow,我们通常使用以下代码行 [[[UIApplication sharedApplication] windows]
我已经尝试解决这个问题很长一段时间了:我无法访问窗口的 url,因为它位于另一个域上..有一些解决方案吗? function login() { var cb = window.ope
是否可以将 FFMPEG 视频流传递到 C# 窗口?现在它在新窗口中作为新进程打开,我只是想将它传递给我自己的 SessionWindow。 此时我像这样执行ffplay: public void E
我有一个名为 x 的矩阵看起来像这样: pTime Close 1 1275087600 1.2268 2 1275264000 1.2264 3 1275264300 1.2
在编译时,发生搜索,grep搜索等,Emacs会在单独的窗口中创建一个新的缓冲区来显示结果,有没有自动跳转到那个窗口的方法?这很有用,因为我可以使用 n 和 p 而不是 M-g n 和 M-g p 移
我有一个启动 PowerShell 脚本的批处理文件。 批处理文件: START Powershell -executionpolicy RemoteSigned -noexit -file "MyS
我有一个基于菜单栏的应用程序,单击图标时会显示一个窗口。在 Mac OS X Lion 上一切正常,但由于某种原因,在 Snow Leopard 和早期版本的 Mac OS X 上会出现错误。任何时候
在 macOS 中,如何在 Xcode 和/或 Interface Builder 中创建带有“集成标题栏和工具栏”的窗口? 这是“宽标题栏”类型的窗口,已添加到 OS X 10.10 Yosemit
在浏览器 (Chrome) 中 JavaScript: var DataModler = { Data: { Something: 'value' }, Process: functi
我有 3 个 html 页面。第 1 页链接到第 2 页,第 2 页链接到第 3 页(为了简单起见)。 我希望页面 2 中的链接打开页面 3 并关闭页面 1(选项卡 1)。 据我了解,您无法使用 Ja
当点击“创建节点”按钮时,如何打开一个新的框架或窗口?我希望新框架包含一个文本字段和下拉菜单,以便用户可以选择一个选项。 Create node Search node
我有一个用户控件,用于编辑应用程序中的某些对象。 我最近遇到一个实例,我想弹出一个新的对话框(窗口)来托管此用户控件。 如何实例化新窗口并将需要设置的任何属性从窗口传递到用户控件? 感谢您的宝贵时间。
我有一个Observable,它发出许多对象,我想使用window或buffer操作对这些对象进行分组。但是,我不想指定count参数来确定窗口中应包含多少个对象,而是希望能够使用自定义条件。 例如,
我有以下代码,它打开一个新的 JavaFX 阶段(我们称之为窗口)。 openAlertBox.setOnAction(e -> { AlertBox alert = AlertBox
我要添加一个“在新窗口中打开”上下文菜单项,该菜单项将以新的UIScene打开我的应用程序文档之一。当然,我只想在实际上支持多个场景的设备上显示该菜单项。 目前,我只是在检查设备是否是使用旧设备的iP
我正在尝试创建一个 AIR 应用程序来记录应用程序的使用情况,使用 AIR 从系统获取信息的唯一简单方法是使用命令行工具和抓取 标准输出 . 我知道像 这样的工具顶部 和 ps 对于 OS X,但它们
所以我有这个简单的 turtle 螺旋制作器,我想知道是否有一种方法可以打印出由该程序创建的我的设计副本。 代码: import turtle x= float(input("Angle: ")) y
我正在编写一个 C# WPF 程序,它将文本消息发送到另一个程序的窗口。我有一个宏程序作为我的键盘驱动程序 (Logitech g15) 的一部分,它已经这样做了,尽管它不会将击键直接发送到进程,而是
我尝试使用以下代码通过 UDP 发送,但得到了奇怪的结果。 if((sendto(newSocket, sendBuf, totalLength, 0, (SOCKADDR *)&sendAd
我是一名优秀的程序员,十分优秀!