home *** CD-ROM | disk | FTP | other *** search
- #include <MacWindows.h>
- #include <Dialogs.h>
- #include <CoreFoundation/CFBundle.h>
- #include "AboutBox.h"
-
- #define kAboutBox 200 /* Dialog resource for About box */
-
- void DoAboutBox(void)
- {
- CFBundleRef appBundle, fwBundle;
- CFStringRef cfVersionString;
- Str255 pascalVersionString;
- short ierr, globalRefNum, localRefNum;
-
- /* Get the application's short version string. */
- appBundle = CFBundleGetMainBundle();
- cfVersionString = (CFStringRef) CFBundleGetValueForInfoDictionaryKey(
- appBundle, CFSTR("CFBundleShortVersionString"));
- if ((cfVersionString == CFSTR("")) || (cfVersionString == NULL))
- cfVersionString = CFSTR("Nameless Application");
- CFStringGetPascalString(cfVersionString, pascalVersionString, 256,
- CFStringGetSystemEncoding());
-
- /* Open the framework's resource fork. */
- fwBundle = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.tutorial.aboutbox" ));
- ierr = CFBundleOpenBundleResourceFiles( fwBundle, &globalRefNum, &localRefNum );
-
- /* Display the about box (from the framework)
- with the version string (from the application). */
- ParamText(pascalVersionString,"\p","\p","\p");
- (void) Alert(kAboutBox, nil);
-
- /* Close the framework's resource fork. */
- CFBundleCloseBundleResourceMap(fwBundle, globalRefNum);
- CFBundleCloseBundleResourceMap(fwBundle, localRefNum);
- }
-