> I am using the following code to get my application version.
>
> I get compile errors because 'uaecptr' is undeclared. What header
> is required?  I can't find uaecptr anywhere.  Also, where is verRsc

Here's the code I am using in my app. It's called like:

    CharPtr verString;
    Boolean result;

    verString = MemPtrNew(8);           // Change size as needed
    ErrFatalDisplayIf(!verString,
                      "Could not allocate memory!");
    result = (GetAppVersion(1, verString);
    ErrFatalDisplayIf(!result,
                      "Could not get version resource!");

The GetAppVersion function is defined as follows:

   /*
    * Get the application version from a tver resource.
    * Parameters:
    *     resourceNum: The resource ID of the tver resource
    *     dest       : A CharPtr to hold the version string
    * Returns:
    *     True on success, false on error.
    *     Also sets dest to the version string.
    */

    static Boolean GetAppVersion(Word resourceNum, CharPtr dest)
    {
        CharPtr foo;
        VoidHand verRsrc;

        if (dest == NULL)
            return false;

        MemSet(dest, StrLen(dest), 0);

        verRsrc = (VoidHand)DmGetResource(verRsc, 1);
        if (verRsrc == NULL)
            return false;

        foo = (CharPtr) MemHandleLock(verRsrc);
        if (foo == NULL)
            return false;

        StrNCopy(dest, foo, StrLen(foo));
        MemHandleUnlock(verRsrc);
        DmReleaseResource(verRsrc);
        return true;
    }

To answer your other question, verRsc is defined in UICommon.h, which
is included by Pilot.h. It's defined like this:

#define verRsc 'tver'

So, the legal values for that parameter are any resource type. The
predefined types are given in UICommon.h.

Hope this helps.
Tammy


Reply via email to