Get WindowRef Borders?

I am trying to find the Carbon API that can give me WindowRef from the window id and with that windowref. I want to have borders?

EDIT: I found the extern WindowRef API HIWindowFromCGWindowID (CGWindowID inWindowID); But I can’t use it. I included a carbon headline and also added its structure for the project. Is there anything else for HI apis?

Any help is appreciated. Thank you for your time.

+4
source share
1 answer

The following should do -

CGRect rect; uint32_t windowid[1] = {windowID}; CFArrayRef windowArray = CFArrayCreate ( NULL, (const void **)windowid, 1 ,NULL); CFArrayRef windowsdescription = CGWindowListCreateDescriptionFromArray(windowArray); CFDictionaryRef windowdescription = (CFDictionaryRef)CFArrayGetValueAtIndex ((CFArrayRef)windowsdescription, 0); if(CFDictionaryContainsKey(windowdescription, kCGWindowBounds)) { CFDictionaryRef bounds = (CFDictionaryRef)CFDictionaryGetValue (windowdescription, kCGWindowBounds); if(bounds) { CGRectMakeWithDictionaryRepresentation(bounds, &rect); } } CFRelease(windowArray); 
+8
source

All Articles