如何清除Cocoa窗口? [英] How to reparent a Cocoa window?

查看:141
本文介绍了如何清除Cocoa窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在另一个应用程序的窗口上托管我的窗口。
如何枚举另一个Cocoa应用程序的窗口?是否可以控制

如果否:我如何可以在另一个应用程序的窗口上?
谢谢!

I need to host my window upon a window of another application. How to enumerate windows of another Cocoa application? Is it possible to control them? If no: how can I draw upon a window of another application? Thanks!

推荐答案


如何枚举另一个Cocoa应用程序的窗口? >

How to enumerate windows of another Cocoa application?

您可以使用辅助功能API枚举另一个应用程序的窗口。

You can enumerate the windows of another application using the Accessibility API. It doesn't matter whether that application is Cocoa or not.


是否可以控制它们?

Is it possible to control them?

这里,它是间接的,无论应用程序是Cocoa(或Carbon使用标准控件)。

Here, it does matter, indirectly, whether the application is Cocoa (or Carbon using standard controls). More precisely, it matters whether the application is accessible.

通常可以移动另一个窗口,调整它的大小,或者使用控件在其中做简单的操作(例如按下按钮)。

It usually is possible to move another window, resize it, or do simple things with controls in it (such as press buttons).

无法将其中一个窗口磁贴到另一个应用程序的窗口。你将不得不观察它的位置,并移动你的窗口时,其他的移动。

It is not possible to tape one of your windows to a window in another application. You will have to observe its location and move your window when the other moves. Following a live drag this way is not possible.


如果没有:如何绘制另一个应用程序的窗口?

If no: how can I draw upon a window of another application?

您不能。您只能在自己的窗口中绘制。

You can't. You can only draw in your own windows.

您可以创建一个透明的重叠窗口,然后绘制它,但这会让你回到你的窗口

You can make a transparent overlay window and draw on that, but that gets you back to the problem of taping one of your windows to a window in another application.

您可能会通过将其中一个窗口粘贴到另一个应用程序的窗口中来询问一个更广泛的问题,关于您希望实现什么,通过在另一个应用程序中绘制窗口。

You should probably ask a broader question about whatever it is you hope to achieve by taping one of your windows to a window in another application or by drawing into a window in another application.

这篇关于如何清除Cocoa窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆