mamady
mamady

Reputation: 231

How to find monitor count in mac os by Cocoa?

I want to find count of monitor in mac OS by Cocoa.I can not use carbon.This code written in carbon but i want to do it in Cocoa framework.

CGDisplayCount dspCount;
CGError err ;
err = CGGetActiveDisplayList(0, NULL, &dspCount);
return (int)dspCount;

Upvotes: 2

Views: 878

Answers (1)

trojanfoe
trojanfoe

Reputation: 122391

Use the NSScreen class:

return [[NSScreen screens] count];

See the reference.

Upvotes: 6

Related Questions