TweetFollow Us on Twitter

August 92 - MACINTOSH Q & A

MACINTOSH Q & A

MACINTOSH DEVELOPER TECHNICAL SUPPORT



Q Is it my imagination, or does GetPictInfo return a bit depth of 1 on QuickTime compressed PICT files? 

A Yep! This is what's happening: The Picture Utilities Package doesn't know of the QuickTime Compressed Pixmap opcode (0x8200), so it just skips over the opcode's data; then it finds the PacksBitRect opcode containing the black-and-white pseudo-alert that you get when you draw the picture on a machine that doesn't have QuickTime installed, and GetPictInfo reports back this alert.

Trivia: When QuickTime is installed, it displays the compressed image and then ignores the following PacksBitRect since QuickTime knows it's only the black-and-white alert.

Q Is it true that if I double-click a document belonging to my application, the application will be launched and will receive an 'odoc' Apple event, but will not receive an 'oapp' event--that is, it will receive either 'odoc' or 'oapp' but not both? 

A Yes, except actually it will receive one of 'oapp', 'odoc', or 'pdoc'. The 'pdoc' will be followed (as the next event) by a 'quit' if the 'pdoc' was the event sent as the application was launched.

This is the normal  sequence of events, and should be adhered to by everyone who launches applications. However, it isn't enforced by the system or the Finder. It's possible for any application to launch your application with any  event, since it can stuff anything in the launchAppParameters field of LaunchApplication, as long as it's a valid high-level (not even Apple) event. Launching another application this way would be bad programming, and would break most applications, but you should be aware that someone who doesn't understand event handling may do this to you.

Note that if another application launches your application using LaunchApplication and doesn't specify any high-level event in the launch parameter block, the Finder will automatically supply the 'oapp' event. So, in general, if Apple events and launching have been coded correctly, you'll always receive an 'oapp', 'odoc', or 'pdoc'.

Q I'm using the Picture Utilities Package to extract the color table from a picture. After getting the color table, I use NewPalette to construct a palette from the color table (usage = tolerant, tolerance = 0). After I do this, the RGB values in the palette don't always exactly match the RGB values in the source color table, causing my program to fail. If I use NewPalette without a source color table, and then use CTab2Palette to copy the colors over (again with usage = tolerant, tolerance = 0), the colors match exactly. 

A It turns out that NewPalette doesn't use CTab2Palette, but copies the RGB fields in a strange way that's causing the problems you're seeing. NewPalette copies the high byte in each color table RGB entry into both the high byte and the low byte of the corresponding palette entry. Thus, if the color table entry for red was $F000, it becomes $F0F0. This of course makes no difference to QuickDraw since the low byte isn't displayed, but if your program expects the low byte to match, that's where your problem exists. CTab2Palette is different, in that it doesn't copy the high byte into the low byte unless the pmAnimated bit is set.

The best solution for your code isn't to compare the entire RGB value when comparing colors, but rather to compare the high byte of each RGB component separately. If this isn't possible, the next best solution is for you to use the workaround that you've already discovered with CTab2Palette. It's unlikely that the Palette Manager is going to change in the future for something like this. In fact, we would almost call it a "feature" since other developers may even depend on it.

Q My application wants to open other applications and play with the resources therein, like ResEdit, but when it calls OpenResFile on an application, the program gets lost in GetNamedResource. Is there something I'm missing? 

A Your problem stems from the fact that some resources in the application file you're opening with OpenResFile are marked to be preloaded, and so are loaded into memory when the resource fork is opened.

Since most applications have CODE resources marked to be preloaded, this turns into a much bigger problem, because the Segment Loader will treat these preloaded CODE resources as your code resources if you make a between-segment call that triggers a call to LoadSeg while the opened resource file is first in the resource chain. If this happens, you'll begin executing code out of the other application, which will cause your Macintosh to crash and burn.

The solution to this problem is to bracket OpenResFile calls with SetResLoad(FALSE) and SetResLoad(TRUE), and to avoid making between-segment calls when you've got another resource file open that contains CODE resources. This will not only prevent your application's memory from being used by preloaded resources that you don't want, but will also prevent the Segment Loader from jumping into the other application's code. If you need to get CODE resources out of the opened resource file, you can still prevent the Segment Loader problem by calling UseResFile on your application's resource reference number to put your application at the top of the resource chain.

Q How can our application search for files by label or color, getting the actual string for the label/color field, so that users can select from a menu that looks like what they'd see in the Finder or ResEdit? 

A In the icon utilities there's a call that will get you the RGB color and string for the Finder's labels. Information from the May 1992 revision of Macintosh Technical Note "Drawing Icons the System 7 Way " (formerly #306) is shown below. It includes the glue code for the call in MPW Pascal and C formats.

FUNCTION GetLabel (labelNumber: INTEGER; VAR labelColor: RGBColor;
    VAR labelString: Str255): OSErr;
INLINE $303C, $050B, $ABC9;

The label number is in the range of 0 to 7, and is available in bits 1-3 of the file's Finder flags (Inside Macintosh  Volume VI, page 9-36). The call returns the actual color and string used in the Label menu of the Finder and the label's control panel. This information is provided in case you want to include the label text or color when displaying a file's icon in your application.

Q I'm making an asynchronous low-level File Manager call from inside a completion routine (for example, error := PBxxx(@PB, TRUE);). Occasionally on some machines, the call immediately returns an error in the function result even though everything appears to work correctly. Do I need to worry about the result when I make the call? 

A It sounds as if you're making the mistake of testing the function result of an asynchronous File Manager call (the value of register D0 is returned in the function result). There's no useful information in the function result of an asynchronous call made to the File Manager; the call might not even have been looked at by the File Manager yet. The call's result status is stored only in ioResult after the call completes, or in either D0 or ioResult at the entry to the completion routine. If you're polling to check for the call's completion, ioResult will indicate the call has completed when it's less than or equal to 0. In general, when making asynchronous I/O calls (reads or writes) there are only two types of function result error that are of any possible consequence: a "driver not open" error (notOpenErr) and a driver reference number error (badUnitErr or unitEmptyErr), which indicate the call wasn't successfully queued by the driver and the ioCompletion routine won't be called. Neither one of these error conditions makes any sense for the File Manager (which isn't a driver); the File Manager will always  call the completion routine (if any) of a given asynchronous call. Your program should just ignore the function result of an asynchronous low- level File Manager call and leave it up to the completion routine or the routine polling ioResult to check for and handle any errors that may have happened on the call.

Q Many of the new File Manager calls are just HFSDispatch with new selector codes. How do I check whether a given selector is implemented? An example of a new File Manager call is GetVolParms. Currently I don't check, I just read the result code. It seems to be OK. How should I interpret the response from Gestalt when called with gestaltFSAttr? As I read it, gestaltFullExtFSDispatching tells me that all the calls are available. Are there times that only a few of them are available? PBHGetVolParms seems to be available at all times anyway. Where do I find more info on the workings of HFSDispatch? In general I would appreciate some more info on the compatibility issue. 

A There are two issues. One is that not all versions of the File Manager support all calls. The other is that even if the File Manager supports the calls, individual volumes may not.

The first issue is addressed by Gestalt's gestaltFSAttr selector. Before System 7, HFSDispatch supported a fixed range of selectors. The result was that some advanced file services were unavailable, even though the volume would support them. A good example is PBCatSearch. If you mount an AppleShare 3.0 or FileShare volume under System 6 with the AppleShare 3.0 Chooser extension, the volume will report via PBHGetVolParms that bHasCatSearch is true. But if you try to make the call, you'll get back a paramErr because HFSDispatch doesn't know about the CatSearch selector.

System 7 doesn't restrict the range of HFSDispatch selectors. For external file systems, this means it's up to the external file system to determine whether it can handle the selector and to return an appropriate error if it cannot. This is the meaning of the gestaltFullExtFSDispatching flag. If it's true, there are no limitations on the range of selectors.

The second problem is that even though HFSDispatch won't limit the range of selectors, the volume may still not support the call. To turn the previous example around, making a PBCatSearch call in System 7 to a pre-AppleShare 3.0 volume will result in an error because the volume doesn't support the call.

The best way to determine whether a volume supports a feature is to use PBHGetVolParms. This can return most of the information you need about advanced file system calls. Unfortunately, there can be problems even with that. For example, when the user turns file sharing on and off, the bHasPersonalAccessPrivileges flag can change. So you can't just test attributes once and assume they'll never change.

As far as knowing whether PBHGetVolParms is available, this is not a new call. It's documented in Chapter 21 of Inside Macintosh  Volume V. The way to check for it is to simply call it and if you get back a paramErr, it's unsupported (page 387). This seems to be what you're doing, so you should be safe.

To summarize, there's no guaranteed way to know if a particular selector will work (but it should never crash, just return paramErr). The right sequence of steps is to first check to see if the HFS supports the full range of calls, then check for specific features using PBHGetVolParms. And in any event, you should always check for errors and be prepared to take appropriate action. A good example of how to do this can be found in the January 1992 version of the Macintosh Technical Note "Searching Volumes--Solutions and Problems" (formerly #68).Q How does Developer Technical Support manage to answer so many difficult questions so accurately? 

A We swear by the Magic 8-Ball as a technical reference. Not only is it convenient, user-friendly, and available at your local toy store for less than ten dollars, but it's guaranteed 100% correct. This way, we manage to answer all questions quickly and accurately and still leave time for playing Spaceward Ho!

Q What's the purpose of the MacApp 'mem!' and 'seg!' resources, and where does the documentation for these resources exist? 

A The 'mem!' resource allows you to change MacApp's memory allocation reserves in various ways. Each contains three numbers: the amount to add to the temporary reserve, which is used for system allocations such as system resources and temporary handles; an amount to add to the permanent reserve, which is used by you for your memory allocation; and an amount of stack space. Having multiple 'mem!' resources causes their values to be summed; in this way, you can create a "debugging" 'mem!' resource that gives you extra space and delete it when you produce a non-debug version. This is discussed in the MacApp 2.0 General Reference,  in Chapter 3.

The 'seg!' resource is used to reserve space for code segments. If the Macintosh ever tries to load a code segment but fails due to lack of memory, it will crash. Thus, MacApp keeps a store of memory solely for loading code resources. It sizes this reserve by adding together the sizes of the segments named in the 'seg!' resource. One way to do this would be to just name all the segments, so that you know there's room for them all; however, this would be wasteful, because many segments are often unused (your printing code, for example). So what you do is name only those segments that represent the largest code path you can have--the calling chain that would require the largest set of code segments to be loaded at any time. This is also described in Chapter 3 of the MacApp General Reference.  In contrast, 'res!' names segments that must  be resident all the time; they're actually loaded and made resident, as opposed to the 'seg!' segments, which are used only to calculate how much memory should be reserved for segments in general.

Q I've been thinking of shutting down the System 7 Finder. Is this a cool thing to do in my application? 

A We normally recommend that you don't quit the System 7 Finder application. Nevertheless, there may be a few good reasons to shut down the Finder. For example, the Installer (the only application Apple ships with a good reason to do so) sometimes needs to shut down the Finder and all other applications to make sure system resources aren't being used while they're being updated by the Installer.

If you find yourself in a situation where you need to shut down the Finder, you should know about a few things:

  • Before you shut down the System 7 Finder, use the Process Manager to see if the File Sharing Extension is running. If so, you should shut it down before shutting down the Finder. The File Sharing Extension shouldn't be running without the Finder because the Finder is the only user interface the File Sharing Extension has. You shouldn't take away the user interface to file sharing. There's another good reason to shut down the File Sharing Extension before the Finder. The Network Extension (not the Network control panel) handles all the user interface transactions among the Finder, the File Sharing Monitor control panel, the Sharing Setup control panel, the Users & Groups control panel, and the File Sharing Extension (the file server). The Network Extension opens another file, the Users & Groups Data File, so that it can manipulate users and groups. When you shut down the Finder (with a kAEQuitApplication Apple event), the Network Extension and its connection to the Users & Groups Data File are also closed (almost). Because of a minor bug in the system, the File Manager thinks that the file is closed and that the FCB used by that access path is free for reuse; however, the File Sharing Extension thinks the access path to the Users & Groups Data File from the Network Extension is still open. When the File Manager attempts to reuse that FCB to open another file later, the file is opened, but because the File Sharing Extension thinks that FCB is still in use by the Network Extension, it won't allow access to the file and it returns opWrErr (-49) to the Open call. At this point, the file that someone was attempting to open can't be accessed or closed.
  • If the Finder is shut down and then eventually relaunched, there may be some fragmentation of the MultiFinder heap. This can occur because the Finder is the first application to be started, so it's always first in the MultiFinder heap. When you shut it down, that memory becomes available and other processes might occupy that space. When the Finder is restarted, if it can't get into its original space in the MultiFinder heap, it will get loaded somewhere else and probably won't be shut down again.
  • In System 7, the Finder is responsible for filling the Apple menu with the items in the Apple Menu Items folder. When the Finder is gone, so are the Apple menu items, including things that are important to most users (like control panels).
  • If the user has selected background printing with a LaserWriter or StyleWriter, nothing will print while the Finder is gone. That's because the Finder is responsible for monitoring the PrintMonitor Documents folder and launching the PrintMonitor application when necessary.

Q My Balloon Help message doesn't appear when I use a 'TEXT' resource in a static window as the message in the balloon, following string resource examples in Inside Macintosh Volume VI and modifying the code to indicate 'TEXT'. Why doesn't this work? 

A While using 'TEXT' resources in Help Manager balloons is a way to provide stylized text, it doesn't mean that strings longer than 256 are possible. In fact, strings up to only 239 characters in length are valid. When string lengths are greater than 239 the Help Manager takes a short- circuit return and no balloon is displayed. To work around this limit, you can draw a picture with the text you want to display and then use the picture in the Help Manager balloon.

Q My TrueType font has all 256 characters defined with a unique glyph. I've been unable to draw the $20 (space) character. DrawChar, DrawText, DrawString, and DrawJust all ignore this character in the font and draw a blank character. How can I draw it? 

A Unfortunately, the problem with the space character not being drawn is hard-coded into the text-drawing routine in the core of QuickDraw. ASCII 32 is always "optimized away," regardless of the font being used or of the particular circumstances. The only workaround is to put the corresponding character elsewhere in the ASCII character encoding (or, if this isn't possible, to use an additional font).

You're lucky that TrueType fonts always render the ASCII code 13 (carriage return) if it has a glyph in the font; for bitmapped fonts, if the character drawing happens with scaling, or with foreground/background colors different from black/white, even the CHR(13) drawing is optimized away.

Q After connecting to a remote network via AppleTalk Remote Access (ARA) I can call PGetAppleTalkInfo and it returns the proper zone name. However, after disconnecting, PGetAppleTalkInfo still returns the remote network's zone name instead of "*" or nothing as I would expect. Is there some period of time I should wait before expecting the zone name and network number to return to zero (no internet)? 

A This is, in fact, a bug with ARA version 1.0. Apple is investigating the problem and there will be a fix in a future release. An easy workaround is to check the GetZoneList or GetMyZone call to see if it returns any zones.

Q My application opens a number of resource files. If my 'hrct' resources aren't in the most recently opened resource file, I get an error -192 (resource not found) from HMGetIndHelpMsg. Is this a Help Manager bug? 

A Your 'hrct' resources get loaded only from the most recently opened resource file because that's where the Help Manager is looking for them. The Help Manager uses Get1Resource to get 'hrct'-type resources to avoid Resource Manager conflicts with other resources. This is simply a behavior of the Help Manager. To use HMGetIndHelpMsg properly, call UseResFile with the refNum of the file containing the 'hrct' before you call the Help Manager. If the 'hrct' is stored in your application resource fork, you can use HomeResFile or CurResFile (at the start of your program before you've opened any other resource files) to get the refNum of the application resource file.

Not all Help Manager resources are treated this way, due to the design of the Macintosh Toolbox; 'hdlg' resources, for example, are loaded using GetResource so that things like Standard File can have common help throughout all applications.

Q We're having problems with the GetScrap function in our desk accessory. After a user opens our DA, when we call GetScrap to get any text from the Clipboard, GetScrap returns -102 (no requested type in scrap). After once (or more?) through the event or SystemTask loop, the scrap suddenly shows up. What's causing this? 

A The reason for the trouble you're having with desk accessories and GetScrap is that you're looking for the converted scrap at the wrong time in the process. According to the MultiFinder documentation (Programmer's Guide to MultiFinder  and Inside Macintosh  Volume VI), an application is supposed to convert its private scrap and write it to the public scrap when it receives a suspend event. When the system opens your DA, it immediately sends it an Open message; the application hasn't received its suspend event yet. You have to wait until the scrap has been converted. This, for a DA, should occur at the first null event, and for applications, when you get a resume event.

Q QuickTime is a joy! But I've run aground with SetMovieRate. I'm trying to change the rate at which a movie plays back, but if I call SetMovieRate the movie starts playing immediately, the controller goes wild, and the next time I hit the play button it ignores the previous rate. How can I control my playback rate? 

A SetMovieRate takes effect immediately; that's why the movie starts playing as soon as you make the call with a rate other than zero. Also, calling SetMovieRate behind the controller's back can only cause confusion because you're changing the state of the movie without letting the movie controller know about the change. Note that in normal operation the movie controller plays back movies at the standard speed, rate = 1; this is the current behavior. It's possible that in a future release the movie controller will use the rate the movie was saved with or the one set with SetPreferredMovieRate.

A little-known fact is that the standard controller does contain a primitive mechanism for controlling the rate of playback. If you hold the Control key down and then click the stepping buttons, you can, for example, play the movie backward. Furthermore, if you hold the mouse button down you'll get a slider control that does let you play the movie at different rates backward or forward.

The slider provided by the standard controller isn't intended to set the rate, so if you play once at low speed the rate doesn't stick and, as you've found, the next time you click the play button you go back to the normal speed. If you need the selected rate to remain for the session, you'll have to provide your own method of selection.

Once you know your desired speed, you'll need to provide your own filter procedure and install it calling MCSetActionFilter. Upon receiving any mcActionPlay actions for rate changes, you'll need to call SetMovieRate to set the movie in motion at the desired rate (and return TRUE). Using a filter procedure is the proper way of doing this because the controller can keep in sync with the actions even though it's your code that actually affects the action. Note that you'll have to do some extra work to mimic the normal behavior of the standard controller. For example, when you're at the end of the movie and the user hits the play button, the controller goes back to the beginning and plays the movie. Your filter proc has to do the same when playing back the movie at a rate different from the normal. A different behavior will confuse the user.

For details on filter procedures, controller actions, and the movie controller in general, see the "QuickTime Components" chapter of the QuickTime Developer's Guide .

Q How does the Magic 8-Ball achieve its high level of technical accuracy? 

A There are two theories on this: The first is that the Magic 8-Ball picks an answer at random and then alters reality to fit the answer it has picked. For example, if you were to ask it "Am I a millionaire?" it might pick "Signs point to yes" at random. Then it would either have to warp reality so that you actually would have a million dollars or, more likely, warp your memory of the question so that you would think you'd asked "Is Elvis still alive?" The other theory is that it's just magic.

Q I'm having trouble with PBGetCatInfo returning old data to my application. For example, if I change a file label using the Finder Label menu and then run my program, which calls PBGetCatInfo, the fdFlags field in the FInfo record returned doesn't reflect the change. I've tried calling PBFlushVol before I do this; the file isn't open, so there's no way to call PBFlushFile. However, restarting the Macintosh or changing the file's name causes PBGetCatInfo to work correctly. What's going on and how do I get around it? 

A The Finder caches much of the "Finder information," including things like the color coding information users can set with the Finder Label menu and the view position of objects in folder windows. Changes to the Finder information are cached until the folder that contains the objects that were changed is closed (which happens at system restart or shutdown time) or until some noncached change is made to the object (for example, the file is renamed). The Finder caches what it considers Finder-specific information to cut down on the number of disk accesses it must make. (For example, rearranging the object view in a window would be very slow on floppy disks if the Finder wrote to the disk every time the user drags a group of objects around.) Since in most cases no other applications should care about the state of the Finder information, this normally doesn't cause problems. There's no workaround for this behavior in the current implementation of the Finder.

Q The Macintosh QuickDraw routine ObscureCursor hides the cursor until the next time the mouse is moved, but it isn't affected by HideCursor or ShowCursor. Our application needs to use ObscureCursor while the user is typing but needs the cursor to be visible after no typing has occurred for a short period. How do we "undo" ObscureCursor, since we can't rely on the user to move the mouse? 

A The only way (besides actual mouse movement) to make an obscured cursor visible again is to convince the system that the mouse has moved. There's no really good way to do this via Toolbox calls, so you're going to have to do it the hard way and simply update the low-memory cursor information to tell the system the cursor moved (even though you don't need to update the actual position).

To tell the system the cursor has changed location, simply set the crsrNew flag (a byte located at $08CE) to 1. When the system sees this byte is 1, it will assume the cursor has moved and redraw the unobscured cursor at the appropriate place (where it was all along), and reset CrsrNew, waiting for the mouse to move again.

Q In System 7, I want to place my user's preferences file in the Preferences folder in the System Folder, but I can't seem to get the Preferences folder's directory ID and other information so that my file will appear there! Also, how do I get to that folder if the user changes the names of the System Folder and Preferences folder? And once the user's preferences file is there, am I assuming correctly that the best way to find it again is to make an alias record to track the file ID? 

A System 7 introduced the routine FindFolder for locating the Preferences folder. Just make this call:

 err := FindFolder (kOnSystemDisk, kPreferencesFolderType,
        kCreateFolder, prefVRefNum, prefDirID);

If FindFolder returns noErr, prefVRefNum and prefDirID will contain the vRefNum and dirID of the Preferences folder, which can be used later with HCreateResFile, HOpenResFile, PBHGetFInfo, and other File Manager calls to locate your preferences file. If a Preferences folder doesn't already exist, the kCreateFolder parameter instructs FindFolder to make one and return the vRefNum and dirID of the new folder.

FindFolder is documented in Chapter 9 of Inside Macintosh  Volume VI, under "The System Folder and Its Related Directories." Although FindFolder is implemented only in System 7, if you're using MPW 3.2 (or the current THINK compilers) glue is automatically included in your compiled code, making it safe to call FindFolder in System 6. The glue checks whether FindFolder is available and, if it isn't, returns the System Folder's vRefNum and dirID for the kPreferencesFolderType selector. Use the System Folder values as the location for the preferences file in System 6.

If you're not using a development system that provides the FindFolder glue, your code should check the FindFolder Gestalt selector gestaltFindFolderAttr to see if FindFolder is available. If FindFolder is available, call it. FindFolder is defined as

 FUNCTION FindFolder (vRefNum: INTEGER; folderType: OSType;
    createFolder: BOOLEAN; VAR foundVRefNum: INTEGER;
    VAR foundDirID: LONGINT): OSErr;
INLINE $7000, $A823;

If FindFolder isn't available, call SysEnvirons to find the System Folder's working directory reference number, call PBGetWDInfo or GetWDInfo to convert that number to a true vRefNum and dirID, and use those System Folder numbers for the location of the preferences file. Example code for this is in the Q&A stack, under Operating System:File System:Code for identifying vRefNum and dirID of Macintosh System Folder.

To locate the Preferences folder, follow the steps described above rather than trying to keep an alias of the Preferences folder or of the preferences file. However, if there are any other files in the System Folder that the application depends on (such as dictionaries) those should be tracked with aliases, stored as 'alis' resources in the preferences file. See Chapter 27 of Inside Macintosh  Volume VI for information on using aliases.

Q I recall reading that QuickTime includes an implementation of the Alias Manager for System 6, but I haven't found any precise description of what's included. Is it a bare minimum to support QuickTime? Or is the full Alias Manager there? Also, is there any way I can use the FSSpec interface to the File Manager, or must I revert to the System 6 interface? 

A When QuickTime is installed, most of the Alias Manager is available in System 6, with these exceptions:

  • NewAlias will accept a fromFile parameter, but it never creates a relative alias.
  • NewAliasMinimalFromFullPath and ResolveAliasFile aren't available.
  • ResolveAlias and UpdateAlias will accept a fromFile parameter, but ignore it.
  • MatchAlias may be called, but the kARMMultVols, kARMSearchMore, and kARMSearchRelFirst flags aren't available. If you pass them in, they'll be ignored. Furthermore, if you pass in a matchProc, it will never be called.
  • The System 6 Alias Manager won't mount network volumes.

To summarize, in System 6 the Alias Manager doesn't handle relative aliases, multiple volume searches, "searchMore" searches, and network volume mounting. On the bright side, nearly all calls are present. Aliases created in System 6 are compatible with System 7 aliases, and aliases created in System 7 will work in System 6.

Unfortunately, QuickTime doesn't currently install an Alias Manager Gestalt selector, since it's only a partial implementation. You can check for the Alias Manager using Gestalt and, if it isn't present, look for QuickTime (using Gestalt); if QuickTime is present, assume you have an Alias Manager, subject to the limitations listed above.

QuickTime also makes extensive use of the FSSpec data structure introduced in the System 7 File Manager. Nearly all the FSSpec calls are available in System 6 when QuickTime is installed. The following calls are available in System 6, and should behave as documented for System 7: FSMakeFSSpec, FSpOpenDF, FSpOpenRF, FSpCreate, FSpDirCreate, FSpDelete, FSpGetFInfo, FSpSetFInfo, FSpSetFLock, FSpRstFLock, FSpRename, FSpCatMove, FSpOpenResFile, FSpCreateResFile, and FSpGetCatInfo. FSpExchangeFiles isn't available when using the QuickTime System 6 version of the FSSpec calls.

Again, the Gestalt selector for the FSSpec calls isn't installed when QuickTime is there. This means that the gestaltFSAttr Gestalt selector may not be present, and gestaltHasFSSpecCalls may not be set, even if gestaltFSAttr is present.

Q I would like to implement the preview/thumbnail feature in the Standard File dialog, just like the extension included with QuickTime. Is that code available separate from QuickTime? If not, could I at least get information on how the preview is created? 

A To implement your own preview/thumbnail feature, simply duplicate the Standard File dialog, add the necessary 'DITL' resources, and install a custom filter procedure for handling preview commands. On the System 7 CD there's an example, StdFileSample, that shows exactly how to create a custom file dialog. The Macintosh Technical Note "Customizing Standard File" (formerly #47) describes how to do this as well. For generating and displaying the preview, you can use the following PreviewResourceRecord, found at the end of the ImageCompression.h file:

 struct PreviewResourceRecord {
    unsigned long   modDate;
    short           version;
    OSType          resType;
    short           resID;
};

typedef struct PreviewResourceRecord PreviewResourceRecord;
typedef PreviewResourceRecord *PreviewResourcePtr, **PreviewResource;

This is the format for the 'pnot' resource, which defines the preview for the movie file, usually pointing to a 'PICT' resource. It's all you need to generate QuickTime-compatible preview without using QuickTime.

Q You guys don't really use the Magic 8-Ball to answer programming questions, do you? 

A Reply hazy, try again.


Kudos to our readers who care enough to ask us terrific and well thought-out questions. The answers are supplied by our teams of technical gurus; our thanks to all. Special thanks to Jim "Im" Beninghaus, Neil Day, Matt Deatherage, Tim Dierks, Steve Falkenburg, C. K. Haun, Dave Hersey, Rich Kubota, Scott Kuechle, Edgar Lee, Jim Luther, Joseph Maurer, KevinMellander, Jim Mensch, Guillermo Ortiz, Dave Radcliffe, Greg Robbins, Eric Soldan, Bryan "Stearno" Stearns, Forrest Tanaka, and John Wang for the material in this Q & A column. *

Have more questions? Need more answers? Take a look at the Dev Tech Answers library on AppleLink (updated weekly) or at the Q & As on the Developer CD Series  disc, or ask a Magic 8-Ball.*

 
AAPL
$102.99
Apple Inc.
+0.52
MSFT
$44.38
Microsoft Corpora
-0.50
GOOG
$532.71
Google Inc.
+6.17

MacTech Search:
Community Search:

Software Updates via MacUpdate

OmniOutliner 4.1.3 - Organize your ideas...
OmniOutliner is a flexible program for creating, collecting, and organizing information. Give your creativity a kick start by using an application that's actually designed to help you think. It's... Read more
BBEdit 11.0 - Powerful text and HTML edi...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more
Apple Security Update 2014-005 - For OS...
Apple Security Update is recommended for all users and improves the security of Mac OS X. For information on the security content of this update, please visit this website: http://support.apple.com/... Read more
EyeTV 3.6.6 - Watch and record TV on you...
EyeTV brings a rich TV experience to your Mac. Watch live TV on your Mac. Pause, rewind, and record whenever you want. EyeTV gives you powerful control over what you watch and how you watch it. Put... Read more
RapidWeaver 6.0 - Create template-based...
RapidWeaver is a next-generation Web design application to help you easily create professional-looking Web sites in minutes. No knowledge of complex code is required, RapidWeaver will take care of... Read more
NTFS 12.0.39 - Provides full read and wr...
Paragon NTFS breaks down the barriers between Windows and OS X. Paragon NTFS effectively solves the communication problems between the Mac system and NTFS, providing full read and write access to... Read more
RestoreMeNot 2.0.3 - Disable window rest...
RestoreMeNot provides a simple way to disable the window restoration for individual applications so that you can fine-tune this behavior to suit your needs. Please note that RestoreMeNot is designed... Read more
Command-C 1.1.5 - Clipboard sharing tool...
Command-C is a revolutionary app which makes easy to share your clipboard between iOS and OS X using your local WiFi network, even if the app is not currently opened. Copy anything (text, pictures,... Read more
Macgo Blu-ray Player 2.10.9.1750 - Blu-r...
Macgo Mac Blu-ray Player can bring you the most unforgettable Blu-ray experience on your Mac. Overview Macgo Mac Blu-ray Player can satisfy just about every need you could possibly have in a Blu-ray... Read more
Apple iOS 8.1 - The latest version of Ap...
The latest version of iOS can be downloaded through iTunes. Apple iOS 8 comes with big updates to apps you use every day, like Messages and Photos. A whole new way to share content with your family.... Read more

Latest Forum Discussions

See All

TinType by Hipstamatic (Photography)
TinType by Hipstamatic 1.0 Device: iOS iPhone Category: Photography Price: $.99, Version: 1.0 (iTunes) Description: Create hauntingly beautiful, soul capturing portraits with TinType by Hipstamatic. Inspired by daguerreotypes,... | Read more »
The Latest Update for Heroes of Dragon A...
The Latest Update for Heroes of Dragon Age Introduces Daily PvE Challenges Posted by Ellis Spice on October 22nd, 2014 [ permalink ] | Read more »
A New Trailer has Been Revealed for Epic...
A New Trailer has Been Revealed for Epic of Kings Posted by Jessica Fisher on October 22nd, 2014 [ permalink ] Dead Mage Inc. has released a new, action-packed trailer for the upcoming Epic of Kings. | Read more »
Find the Line Review
Find the Line Review By Campbell Bird on October 22nd, 2014 Our Rating: :: INSLIDE THE LINESUniversal App - Designed for iPhone and iPad Tease out beautiful line drawings in this unique, free-to-play puzzle game.   | Read more »
The Silent Age Episode 2 Review
The Silent Age Episode 2 Review By Jennifer Allen on October 22nd, 2014 Our Rating: :: ROUNDING THINGS OFF NICELYUniversal App - Designed for iPhone and iPad Rounding off a great point and click adventure comes The Silent Age... | Read more »
Craft Your Own Mini-Games with Papercade
Craft Your Own Mini-Games with Papercade Posted by Jessica Fisher on October 22nd, 2014 [ permalink ] iPad Only App - Designed for the iPad Scrapbookers move over, Scrapgaming is the new thing. | Read more »
Reshape Review
Reshape Review By Jennifer Allen on October 22nd, 2014 Our Rating: :: SIMPLE SHAPESUniversal App - Designed for iPhone and iPad Match triangles together to form cubes in this fast-paced and twitchy game.   | Read more »
Miika (Games)
Miika 1.0.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0.0 (iTunes) Description: Miika is a beautiful 3D puzzle game based on camera perspectives combined with the use of optical illusions. Miika challenges... | Read more »
Infuse Pro (Photography)
Infuse Pro 3.0 Device: iOS Universal Category: Photography Price: $9.99, Version: 3.0 (iTunes) Description: ** All-new version 3 includes fully licensed and certified DTS® and DTS-HD® audio! ** | Read more »
Swap Heroes (Games)
Swap Heroes 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: **Half price for a limited time only** Swap Heroes is a casual turn-based strategy adventure. Form a group of heroes and guide them... | Read more »

Price Scanner via MacPrices.net

Save with Best Buy’s College Student Deals
Take an additional $50 off all MacBooks and iMacs at Best Buy Online with their College Students Deals Savings, valid through November 1st. Anyone with a valid .EDU email address can take advantage... Read more
iPad Air 2 & iPad mini 3 Best Tablets Yet...
The new iPads turned out to be pretty much everything I’d been hoping for and more than I’d expected.”More” particularly in terms of a drinking-from-a-firehose choice of models and configurations,... Read more
Drafts 4 Reinvents iOS Productivity App
N Richland Hills, Texas based Agile Tortoise has announced the release of Drafts 4 for iPhone and iPad. Drafts is a quick capture note taking app with flexible output actions. Drafts 4 scales from... Read more
AT&T accepting preorders for new iPads fo...
AT&T Wireless is accepting preorders for the new iPad Air 2 and iPad mini 3, cellular models, for $100 off MSRP with a 2-year service agreement: - 16GB iPad Air 2 WiFi + Cellular: $529.99 - 64GB... Read more
Apple offering refurbished Mac Pros for up to...
The Apple Store is offering Apple Certified Refurbished 2013 Mac Pros for up to $600 off the cost of new models. An Apple one-year warranty is included with each Mac Pro, and shipping is free. The... Read more
Select MacBook Airs $100 off MSRP, free shipp...
B&H Photo has 2014 a couple of MacBook Airs on sale for $100 off MSRP. Shipping is free, and B&H charges NY sales tax only. They also include free copies of Parallels Desktop and LoJack for... Read more
13-inch 2.5GHz MacBook Pro on sale for $100 o...
B&H Photo has the 13″ 2.5GHz MacBook Pro on sale for $999.99 including free shipping plus NY sales tax only. Their price is $100 off MSRP. Read more
Strong iPhone, Mac And App Store Sales Drive...
Apple on Monday announced financial results for its fiscal 2014 fourth quarter ended September 27, 2014. The Company posted quarterly revenue of $42.1 billion and quarterly net profit of $8.5 billion... Read more
Apple Posts How-To For OS X Recovery
OS X 10.7 Lion and later include OS X Recovery. This feature includes all of the tools you need to reinstall OS X, repair your disk, and even restore from a Time Machine backup. OS X Recovery... Read more
Mac OS X Versions (Builds) Supported By Vario...
Apple Support has posted a handy resource explaining which Mac OS X versions (builds) originally shipped with or are available for your computer via retail discs, downloads, or Software Update. Apple... Read more

Jobs Board

Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
Position Opening at *Apple* - Apple (United...
…customers purchase our products, you're the one who helps them get more out of their new Apple technology. Your day in the Apple Store is filled with a range of Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.