I'm coding up my app's preferences for the the first time.  I read the
documentation and it seems straight forward, but they're not being saved (or
loaded?) properly.

I have two methods to handle the loading and saving of the preferences:

static Int16 Version;
Int16 ccPreferences::LoadAppPrefs()
{
    UInt16 size = sizeof(csAppPrefs);
    return PrefGetAppPreferences( 'MYAP', 0, &AppPrefs, &size, true );
}
void ccPreferences::SaveAppPrefs()
{
    PrefSetAppPreferences('MYAP', 0, Version, &AppPrefs, sizeof(csAppPrefs),
true);
}

where AppPrefs is a structure that looks like this:

typedef struct {
    UInt16 Version;
    UInt16 Flags;
    Char RegKey[13];
} csAppPrefs;

when SaveAppPrefs is called, AppPrefs looks good (when I look at it with the
debugger).  But when the app starts up again and LoadAppPrefs is called, the
members loaded for AppPrefs are all zeros.  But, the return from
PrefGetAppPreferences is not "noPreferenceFound" so the App seems to know
that some prefs were saved, but they're either not being saved or loaded
properly.

This seems so straight forward, I'm having trouble figuring out where I
could have gone wrong.

Thanks!
Rich


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to