At 12:00am -0700 00-09-22, Palm Developer Forum digest wrote:
>Subject: Re: get app version
>From: "Laurent Dutour" <[EMAIL PROTECTED]>
>Date: Fri, 22 Sep 2000 08:49:03 +0200
>X-Message-Number: 73
>
>Major parts of these code comes from Palm Computing Samples...
[snip]
>//------------------------------------------------------
>// Retrieve the Version
>//-------------------------------------------------------
>int GetApplicationVersionLong(long * Version)
>{
> LocalID theDBID;
> UInt theCardNo;
> VoidHand theStringHandle=0;
> Err theErr;
> UInt vernum;
> long min, maj, fix;
> int ok;
> char VerString[120];
> char *p;
>
> *Version=0;
> ok=false;
>
> // Get the database Local ID and card number of our application.
> theErr = SysCurAppDatabase( &theCardNo, &theDBID );
>
> if (!theErr) {
> // Try to get db name from tver resource
> theStringHandle = DmGetResource(verRsc, appVersionID);
[snip]
This example assumes that the 'tver' resource will always have a
resource id of 1. If this is only used with your own code, then you
can enforce this constraint, but if you're getting the version number
for any PRC, then you have to also check for a 'tver' with resource
id = 1000.
[snip]
> // No tver resource, so use the version of the application's database
> DmDatabaseInfo( theCardNo, theDBID, NULL, NULL, &vernum,
> NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
This is a good point...falling back to the version number in the DB
header if you can't find a 'tver' resource is the right thing to do.
Though _every_ PRC should have a 'tver' resource, if it's
well-written Palm OS software.
>"Eric" <[EMAIL PROTECTED]> a �crit dans le message news:
>[EMAIL PROTECTED]
> >
> > I want to get the version of default app in PalmOS, but use
> > DmGet1Resource('tver',ID). for the ID, it is found that ID is not fixed,
> > "tver 1" and "tver 1000". how can I get the right version resource
> > directly without try and error.
You can't.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/