Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
DMFkey.c
/* |
File: DMFkey.c |
Description:Uses the Display Manager 2.0 (found in System 7.5.2 and later, or in |
the version 2.0 Display Enabler system extension which ships with |
AppleVision multisync displays) to change the monitor screen resolution |
the specified HxV resolutions. |
This FKey will flip between 640x480 and BIG. |
BIG is up to 2000x2000 if your monitor supports it. |
For information on the use of the RequestVideo sample code, please |
refer to the documentation found in the Display Manager Development |
Kit, or just look at the code and comments to figure it out. |
Author: EWA |
Copyright: Copyright: © 1996-1999 by Apple Computer, Inc. |
all rights reserved. |
Disclaimer: You may incorporate this sample code into your applications without |
restriction, though the sample code has been provided "AS IS" and the |
responsibility for its operation is 100% yours. However, what you are |
not permitted to do is to redistribute the source as "DSC Sample Code" |
after having made changes. If you're going to re-distribute the source, |
we require that you make it clear in the source that the code was |
descended from Apple Sample Code, but that you've made changes. |
Change History (most recent first): |
6/24/99 Updated for Metrowerks Codewarror Pro 2.1(KG) |
2/10/96 New today(EWA) |
*/ |
#define minHorizontalRequest 640 |
#define minVerticalRequest 480 |
#define maxHorizontalRequest 1600 |
#define maxVerticalRequest 1200 |
#define bitDepthRequest 32 |
#include <Types.h> |
#include <Quickdraw.h> |
#include <OSUtils.h> |
#include "RequestVideo.h" // The code that does the real work |
struct INITGlobals { |
QDGlobals initQDGlobals; // FKEY's own private QDGlobals |
unsigned long initQDBase; // FKEY's global base |
}; |
typedef struct INITGlobals INITGlobals; |
main() |
{ |
VideoRequestRec requestRec; |
INITGlobals qdGlobs; |
long oldA5; |
unsigned long theHorizontalRequest; |
unsigned long theVerticalRequest; |
oldA5 = SetA5((long) &qdGlobs.initQDBase); |
InitGraf((Ptr) &qdGlobs.initQDGlobals.thePort); |
theHorizontalRequest = minHorizontalRequest; |
theVerticalRequest = minVerticalRequest; |
requestRec.screenDevice = GetMainDevice (); |
requestRec.reqHorizontal = (*(*(requestRec.screenDevice))->gdPMap)->bounds.right; // main screen is always zero offset (bounds.left == 0) |
requestRec.reqVertical = (*(*(requestRec.screenDevice))->gdPMap)->bounds.bottom; // main screen is always zero offset (bounds.top == 0) |
if (requestRec.reqHorizontal == minHorizontalRequest || requestRec.reqVertical == minVerticalRequest) // on a small screen now? |
{ |
theHorizontalRequest = maxHorizontalRequest; |
theVerticalRequest = maxVerticalRequest; |
} |
requestRec.reqBitDepth = bitDepthRequest; // bit depth request |
requestRec.reqHorizontal = theHorizontalRequest; // H request |
requestRec.reqVertical = theVerticalRequest; // V request |
requestRec.displayMode = nil; // must init to nil |
requestRec.depthMode = nil; // must init to nil |
requestRec.requestFlags = 0; |
if (noErr == RVRequestVideoSetting(&requestRec)) |
{ |
RVSetVideoRequest (&requestRec); |
} |
SetA5(oldA5); |
return (noErr); |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14