[futurebasic] Re: [FB] Need help using the toolbox call 'CGDisplayAvailableModes'

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2007 : Group Archive : Group : All Groups

From: Bernie <fblist.bw@...>
Date: Sun, 25 Nov 2007 11:39:20 +0000
Max asked:

> Q. How does one know which of the 36 modes on my monitor is the  
> currently selected one?

'------------
include "Tlbx CGDisplay.incl"

// CFDictionary.h
toolbox fn CFDictionaryGetValue( CFDictionaryRef theDict, pointer  
key ) = pointer

// CFNumber.h
_kCFNumberLongType = 10
toolbox fn CFNumberGetValue( CFNumberRef number, CFNumberType  
theType, pointer *valuePtr ) = Boolean

dim as CFDictionaryRef dict
dim as CFNumberRef number
dim as SInt32 @ w, h, md
dim as Boolean bool

dict = fn CGDisplayCurrentMode( fn CGMainDisplayID() )
long if ( dict )

number = fn CFDictionaryGetValue( dict, fn CFSTR("Mode") )
long if ( number )
long if ( fn CFNumberGetValue( number, _kCFNumberLongType, @md ) )
print "Current mode:";md
end if
end if

number = fn CFDictionaryGetValue( dict, fn CFSTR("Width") )
long if ( number )
bool = fn CFNumberGetValue( number, _kCFNumberLongType, @w )
end if

number = fn CFDictionaryGetValue( dict, fn CFSTR("Height") )
long if ( number )
bool = fn CFNumberGetValue( number, _kCFNumberLongType, @h )
end if

print "Resolution:";w;" x";h
end if

do
HandleEvents
until gFBQuit
'------------


> Q. Is the assembly code acting like glue in the two FN's where it  
> is used?
> Q. Can those two FN's be written without it so that FBtoC can  
> Universalize it?

Yes.

Bernie