hola
hola

Reputation: 3500

Is there someway to get reference to another application's window from your app?

I'm working on a experimental project and I'm wondering if you can open an external application and have a reference to its window.

If I use NSWorkspace to launch an application like TextEdit, is there any way to get information about TextEdit's window from my application? And then be able to manipulate it.

What I mean by manipulate, is to be able to change style masks, change the title, or remove the drop shadow of the window. Stuff like that.

Upvotes: 2

Views: 329

Answers (1)

l'L'l
l'L'l

Reputation: 47169

One way you could achieve this is by using:

AXUIElementRef

An example might be wanting to get CGWindowID of a Window Role accessibility object:

extern "C" AXError _AXUIElementGetWindow(AXUIElementRef, CGWindowID* out);

This would enable the ability to retrieve the window info by means of the Accessibility API.

More informtion: AXUIElement Header Reference

Upvotes: 2

Related Questions