Programmz
Programmz

Reputation: 159

How to obtain firemonkey MacOS window ID?

On MS Windows one can obtain a window handle by using:

WindowHandleToPlatform(winhandle).wnd

How does one obtain a MacOS Window "id":

for example a function that accepts a window id:

CGWindowListCreateImage(
  CGRect screenBounds, 
  CGWindowListOption listOption, 
  CGWindowID windowID,  // <------------------ here
  CGWindowImageOption imageOption);

Upvotes: 3

Views: 246

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596352

On Windows, WindowHandleToPlatform() retrieves a TWinWindowHandle for a given TFmxHandle. TWinWindowHandle contains (amongst other things) the window's HWND.

On OSX, WindowHandleToPlatform() retrieves a TMacWindowHandle, which contains the window's NSWindow, NSView, NSTrackingArea, and NSOpenGLView objects. You can get a CGWindowID from the NSWindow.windowNumber field, eg:

WindowHandleToPlatform(winhandle).Wnd.windowNumber

Upvotes: 4

Related Questions