Created
May 19, 2015 12:39
-
-
Save Eun/bc5bfaea5dc06825c551 to your computer and use it in GitHub Desktop.
DisplayInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreFoundation/CoreFoundation.h> | |
#include <ApplicationServices/ApplicationServices.h> | |
int main (int argc, const char * argv[]) { | |
CGDisplayCount displayCount; | |
CGDirectDisplayID displays[4]; | |
int i; | |
CGGetOnlineDisplayList(4, displays, &displayCount); | |
for (i = 0; i < displayCount; ++i) { | |
CGRect rect = CGDisplayBounds(displays[i]); | |
printf("%d: %.0fx%.0f ( ", i, rect.size.width, rect.size.height); | |
if (CGDisplayIsActive(displays[i])) | |
printf("active "); | |
if (CGDisplayIsAsleep(displays[i])) | |
printf("sleep "); | |
if (CGDisplayIsBuiltin(displays[i])) | |
printf("builtin "); | |
if (CGDisplayIsMain(displays[i])) | |
printf("main "); | |
if (CGDisplayIsOnline(displays[i])) | |
printf("online "); | |
printf(")\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment