[futurebasic] Re: [FB] Second Monitor

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2004 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Fri, 3 Sep 2004 01:40:28 -0400
Geroge Wood wrote:

>I have written a program that plays Midi/QT files. I want to display the
>words to the songs that are played. I have it working fine on the main
>monitor, but would like to do the following:
>1.  detect if the second monitor is there
>2. If so, then open the window by setting the rect before opening to open it
>on the second monitor. if not then open on the main monitor.(or whatever
>will work.) The monitors may not be the same size. I need to have the window
>to open completely covering the entire desktop including menu bar. I am
>using standard basic with 68K code. Not carbon or PPC.

and Adam Bell added:

>As a newbie (just received FB in the mail today) who owns a 17" and
>19" monitor running side by side under OS X, I'm hoping the answer to
>this question is not specific to 68K machines. I assume there's a
>gestalt check for dual monitors that includes their resolution and
>which has the menu bar, but haven't encountered it yet.

George and Adam,

I played with this tonight and here's a little 
function that scans attached monitors and reports 
their vitals. I have not developed in 68K for a 
long time, but I did run a test and this appears 
to work okay on PPC.

George, I am not running multiple monitors, but I 
think you can use fn SetDeviceAttribute to switch 
monitor priority by feeding the function the 
GDHandle and setting the GDevice record 
mainScreen attribute-- kinda the reverse of what 
we do below.

Hey, sounds to me like you're into karaoke! I'm 
curious about whether or not you are using 
standard karaoke conventions or are rolling your 
own.

I have heavily commented this code in hopes it will make it easier to follow.

Maybe it will be of some help.

Ken

/*

    FN GetMonitorInfo

    Scans for all active monitors on system
    and reports their status

    Ken Shmidheiser
    Somerset, KY 42501

    9-3-2004

*/
local fn GetMonitorInfo
dim as GDHandle  gdHandle
dim as short     counter, bitDepth, temp
dim as Str255    monitor, depth, kind
dim as long    @ r

// Device Attribute Constants
_mainScreen   = 11
_screenDevice = 13
_screenActive = 15

counter = 1

// Get handle to first device
gdHandle = fn GetDeviceList

// Loop until all devices are tested
while (gdHandle != _nil)

// Make sure the GDevice is an active monitor
long if (( fn TestDeviceAttribute( gdHandle, _screenDevice ))¬
     && ( fn TestDeviceAttribute( gdHandle, _screenActive )))

// Test to see if this is the main monitor with menubar"
long if ( fn TestDeviceAttribute( gdHandle, _mainScreen ))
kind = " (Main monitor with menubar)"
xelse
kind = " (Secondary monitor)"
end if

// Store monitor number being tested in a string
fn NumToString ( counter, monitor )

// Get monitor bit depth and store it in a string
temp = [ [gdHandle] + _gdPMap ]
bitDepth = { [temp] + _pmPixelSize }
fn NumToString ( bitDepth, depth )

// Determine monitor's rect bounds
r.nil%;8 = @gdHandle..gdRect%

// Print out the stored information
print "Monitor No. "; monitor; ": "; depth;¬
                   "-bit depth at"; r.right;¬
              " x"; r.bottom; " resolution";¬
                                       kind
end if

// Get the next device
gdHandle = fn GetNextDevice ( gdHandle )
counter++

wend

end fn

window 1

fn GetMonitorInfo

include "Subs Quick Event Loop.Incl"