[comp.sys.mac.programmer] GetCIcon on a Mac +

erich@crash.cts.com (Eric Hicks) (06/13/91)

Does anyone know exactly what happens if one tries to call a color QuickDraw
function (e.g. GetCIcon) from a non CQD machine? (e.g. a Mac Plus) I'm trying
to debug someone elses code (really! 8) ) and I think the problem is related
to this sort of situation. However, since later versions of system software
patch the ROMS, (the Plus is running 6.0.5) I thought that GetCIcon might be
patched to RAM. Are color Ram patches installed on b&w Macs? I guess the
upshot to what I'm wondering is, does the system software catch the call to
GetCIcon and perhaps convert it to a regular GetIcon call, or is there no
implementation for catching it? Perhaps someone from Apple reads this
newsgroup... Any help from anyone would be appreciated, thanks in advance.
 

boerned@mist.CS.ORST.EDU (Dan Boerner) (06/13/91)

erich@crash.cts.com (Eric Hicks) writes:
"Does anyone know exactly what happens if one tries to call a color QuickDraw"
"function (e.g. GetCIcon) from a non CQD machine? (e.g. a Mac Plus)"

Last time I tried this it resulted in the big LaBomba.  The GetCIcon is an
Unimplemented Trap on non Color QD machines like the Mac Plus. 
I'm fairly sure that although some color QD features have been added to 
System 7.0 (like fake GWorlds), this trap is still unavailable on non Color QD
machines. 

To avoid the problem you should check for the availability of Color QD before
you make the GetCIcon call.  You can do this with Gestalt (described in IM-VI)
or SysEnvirons (described in IM-V) if Gestalt is unavailable.  The trick is to
check first, then call GetIcon instead.  Try something like this:

gHasColorQD is set during initialization...

	if gHasColorQD then
		aCIconHandle := GetCicn(iconRsrcID)
	else
		anIconHandle := GetIcon(iconRsrcID);

then later when you're ready to draw...

	if gHasColorQD then
		PlotCIcon(theRect,aCIconHandle)
	else
		PlotIcon(theRect,anIconHandle);

then when you're done..

	if gHasColorQD then
		DisposeCIcon(aCIconHandle);


--Dan Boerner
  Oregon State University