Richard: I do not see anything obviously wrong with your code. I do note that it uses globals, so I hope that neither routine is called at a time when globals are not available.
I would suggest that you get yourself a copy of a preference viewer program such as "Preference Editor", "PrefViewer", or "PrefMgr" and inspect your preferences after saving but before loading. -bob mckenzie, palmsource pdx -----Original Message----- From: Richard Coutts [mailto:rcoutts@;attbi.com] Sent: Thursday, October 31, 2002 9:10 PM To: Palm Developer Forum Subject: newbee's app preferences aren't sticking 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/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
