PostMessage() or such on OS X. Sending messages to a window

1.2k Views Asked by At

What is the equivalent of PostMessage/SendMessage in Windows on Mac OS X?

I have recently started out with Mac development, with most of my experience coming from Windows and nix.

I want to hook a window and simulate mouse clicks or keyboard presses. Also I want to be able to find a function like GetWindowText or any function that can get a certain text from a window.

1

There are 1 best solutions below

6
On

One can send low-level events using Quartz event APIs such as CGEventPostToPSN. To get text from another app's window, I think your best bet would be the Accessibility APIs (just type "accessibility" in the Xcode search box), though I have no personal experience with that.