(macOS, C++) how to get active window's title bar text?

Samuel Venable

Time Killer
The title of this topic is what I need as one of the last steps to finishing the Mac port to my DialogModule extension. I'd rather not make use of CoCoa because I heard Apple will be replacing that soon. All I need to know is the function name and required header. Then I'll look it up and try to do the rest. I've looked everywhere online about this and there seems to be next to no documentation on macOS C++ development.

Everything I could find seems to be about either Swift or Objective-C. But I am using C++, as it is much better than Apple's crap-languages. I've tried doing it with AppleScript run from a popen call as well but without success, it always returns "Mac_Runner", and not the actual title bar text, just the application bundle's executable name.

Thanks!
Samuel
 

Tthecreator

Your Creator!
mm if all fails you might need to pass window_get_caption(); into your dll from game maker or do you need to do some more manipulation on the window?
 

Samuel Venable

Time Killer
mm if all fails you might need to pass window_get_caption(); into your dll from game maker or do you need to do some more manipulation on the window?
This is a library that I am also using outside of the GameMaker world, so I need everything to be done within the dylib itself.
 

Tthecreator

Your Creator!
Well Apple is Apple I guess and when they want you to something their way they will make sure it goes their way.
They just don't have these kind of frameworks for cpp. You might need to cobble some weird objective-c/cacao library and call that from your cpp library.

It seems you can just compile your cpp code using objective-c (https://stackoverflow.com/questions/2710507/mixing-objective-c-and-c) So maybe that is an option? Just have one .mm file act as wrapper for these critical functions you absolutely need? It seems to be the only option I can think of at this point. (unless you like reverse engineering Apple products;))
 
Top